Symfony2 - fos create super admin custom field required

deployment, doctrine, fosuserbundle, symfony, symfony-2.1

Solution

You should override FOSUserBundle `execute()` method in /Command/CreateUserCommand.php and `create()` method in /Util/UserManipulator.php files. By doing that you should be able to add any additional fields to your User entity from the command line.

Problem

I am deploying a SF2.1 project into production. I have customized the user model so that certain fields are required. So when I try to create my super admin ``` $ php app/console fos:user:create admin my@mail.com my_pass --super-admin ``` I'm getting [PDOException] SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'my_required_field' cannot be null What is the clean way to manage that ? I Imagine not manually inserting the user into the table...

Original source