title: Unable to override Sonata User Bundle registration form
body: <p>I keep getting an error while trying to override sonata registration template.</p>
  
  <p>I extended Sonata User Bundle with EasyExtendsBundle, so I now have src/Application/Sonata/UserBundle.</p>
  
  <p><strong>EDIT:</strong> Symfony 2.7, Sonata Admin 2.3, Sonata User dev-master</p>
  
  <p>I added a field in my User Entity
  <strong>UserEntity.php</strong></p>
  
  <pre><code>&lt;?php
  
  /**
   * This file is part of the &lt;name&gt; project.
   *
   * (c) &lt;yourname&gt; &lt;youremail&gt;
   *
   * For the full copyright and license information, please view the LICENSE
   * file that was distributed with this source code.
   */
  
  namespace Application\Sonata\UserBundle\Entity;
  
  use Sonata\UserBundle\Entity\BaseUser as BaseUser;
  
  /**
   * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
   *
   * References :
   *   working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
   *
   * @author &lt;yourname&gt; &lt;youremail&gt;
   */
  class User extends BaseUser
  {
      /**
       * @var integer $id
       */
      protected $id;
  
     /*
       * @ORM\Column(type="string", length=255)
       *
       * @Assert\NotBlank(message="Please enter your name.", groups={"Registration", "Profile"})
       */
       protected $age;
  
      /**
       * Get id
       *
       * @return integer $id
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
       public function getAge()
      {
          return $this-&gt;age;
      }
  
          public function setAge($age)
      {
           $this-&gt;age = $age;
      }
  }
  </code></pre>
  
  <p>I then created a new RegisterForm
  <strong>Application/Sonata/UserBundle/Form/Type/RegisterType.php</strong></p>
  
  <pre><code>&lt;?php
  
  namespace Application\Sonata\UserBundle\Form\Type;
  
  use FOS\UserBundle\Form\Type\RegistrationFormType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  
  class RegisterType extends RegistrationFormType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
  
          parent::buildForm($builder, $options);
  
          $builder
              -&gt;add('age');
      }
  
      public function setDefaultOption(OptionsResolverInterface $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'validation_groups' =&gt; array('Default', 'Register')
          ));
      }
  
      public function getName()
      {
          return 'front_user_registration';
      }
  }
  </code></pre>
  
  <p>I tell sonata_user to use my form
  <strong>config.yml</strong></p>
  
  <pre><code>sonata_user:
      profile:
          register:
              form:
                  type:               front_user_registration
                  handler:            sonata.user.profile.form.handler.default
                  name:               front_user_registration_form
  
  fos_user:
      db_driver:      orm # can be orm or odm
      firewall_name:  main
  
      # if you change the class configuration, please also alter the sonata_user.yml file
      user_class:     Application\Sonata\UserBundle\Entity\User
  
      group:
          group_class:   Application\Sonata\UserBundle\Entity\Group
          group_manager: sonata.user.orm.group_manager
  
      service:
          user_manager: sonata.user.orm.user_manager
      registration:
          form:
              type: front_user_registration
      profile:
          form:
              type:               fos_user_profile
              handler:            fos_user.profile.form.handler.default
              name:               fos_user_profile_form
              validation_groups:  [Authentication]
  </code></pre>
  
  <p>which I declare as a service
  <strong>services.yml</strong></p>
  
  <pre><code>user.form.register.type:
          class: Application\Sonata\UserBundle\Form\Type\RegisterType
          parent: fos_user.registration.form.type
          tags:
              - { name: form.type, alias: front_user_registration }
  </code></pre>
  
  <p>When I try to display the form, I get the following error :</p>
  
  <blockquote>
    <p>Catchable Fatal Error: Argument 1 passed to
    Sonata\UserBundle\Form\Handler\ProfileFormHandler::process() must
    implement interface FOS\UserBundle\Model\UserInterface, boolean given,
    called in
    /Users/sylv/Sites/generajobs/vendor/sonata-project/user-bundle/Controller/RegistrationFOSUser1Controller.php
    on line 49 and defined</p>
  </blockquote>
  
  <p>Same goes if I add</p>
  
  <pre><code>arguments: [%fos_user.model.user.class%]
  </code></pre>
  
  <p>into my services.yml configuration.</p>
  
  <p>Am i missing something here ?</p>