Fosuserbundle: Can't create new user - "Array to string conversion"

Created on 19 Jun 2013  路  12Comments  路  Source: FriendsOfSymfony/FOSUserBundle

Hi,

I tried to create a new user via the console and got the following error: Notice: Array to string conversion in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php line 103

I used the following command: fos:user:create test [email protected] test

Thanks for help!

Anton

Most helpful comment

:+1:

All 12 comments

Can you paste the full stack trace ? run the command in verbose mode to get it.

Here's the trace:

[ErrorException]
Notice: Array to string conversion in /srv/www/profilportal/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php line 103

Here's the trace:

[ErrorException]
Notice: Array to string conversion in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php line 103

Exception trace:
() at /vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php:103
SymfonyComponentHttpKernelDebugErrorHandler->handle() at n/a:n/a
PDOStatement->bindValue() at /vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php:103
DoctrineDBALStatement->bindValue() at /vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php:275
DoctrineORMPersistersBasicEntityPersister->executeInserts() at /vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:952
DoctrineORMUnitOfWork->executeInserts() at /vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:335
DoctrineORMUnitOfWork->commit() at /vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:395
DoctrineORMEntityManager->flush() at /app/cache/dev/jms_diextra/doctrine/EntityManager_51c1761202a68.php:400
EntityManager51c1761202a68_546a8d27f194334ee012bfe64f629947b07e4919__CG__DoctrineORMEntityManager->flush() at /vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Doctrine/UserManager.php:100
FOSUserBundleDoctrineUserManager->updateUser() at /vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Util/UserManipulator.php:55
FOSUserBundleUtilUserManipulator->create() at /vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Command/CreateUserCommand.php:77
FOSUserBundleCommandCreateUserCommand->execute() at /vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:242
SymfonyComponentConsoleCommandCommand->run() at /vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:193
SymfonyComponentConsoleApplication->doRun() at /vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:78
SymfonyBundleFrameworkBundleConsoleApplication->doRun() at /vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:106
SymfonyComponentConsoleApplication->run() at /app/console:22
include() at /sf:4

It's also impossible to login, to register and to change user roles.

Do you have some custom stuff in your user entity ?

That's all:

class User extends BaseUser
{
    /**
     * @var integer
     */
    protected $id;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
}

Can you help me to fix this problem?

It doesn't work with this code.

I'm running into an error similar to this after setting up a new install of Symfony 2.3.

Notice: Array to string conversion; in regards to setting the roles array.

Notice: Array to string conversion in ... /vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php line 103

2: at ErrorHandler ->handle ('8', 'Array to string conversion', '.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php', '103', array('name' => '21', 'value' => array('ROLE_SOMETHING'), 'type' => object(TextType), 'bindingType' => '2'))

Much of my user entity code etc was copied from a pre-2.3 project.

@nickrouty Without the stack trace of the exception, I cannot really help. but it is really weird to see a TextType here while the value is an array...

@stof Thanks for the reply, I was able to get it figured out. It ended up being an issue with some cached doctrine metadata that wasn't accurate with the current table structure. I cleared those out and it worked fine. Thanks!

:+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karimdev picture karimdev  路  4Comments

tinntsea picture tinntsea  路  5Comments

hermandinho picture hermandinho  路  4Comments

Dine90 picture Dine90  路  5Comments

pmpr-ir picture pmpr-ir  路  3Comments