FOSUserBundle login error ‘Could not convert database value “” to Doctrine Type array’

0 Flares Twitter 0 Facebook 0 LinkedIn 0 0 Flares ×

Refactoring an existing project and migrating to Symfony2 I had to import 4000 users into the FOSUserBundle table fos_user.

I wrote a little import script that unfortunately updated some columns with an empty string. These columns were used by Doctrine for storing arrays:

  • roles (DC2Type:array)
  • facebook_data (DC2Type:json)
  • twitter_data (DC2Type:json)
  • gplus_data (DC2Type:json)

After trying to login I got the following error:

Could not convert database value “” to Doctrine Type array

The solution was to replace the empty string with the expected array e.g.:

If you want to add Roles you can use the FOSUserBundle command line tools:

FOSUserBundle Command Line Tools:

https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/command_line_tools.md

 

Backlinks:

http://stackoverflow.com/questions/8818387/doctrine2-conversion-error

Web Deviloper