title: overriding FOSUserBundle Registration Form Type
body: <p>I created a Bundle called AccountBundle in the path <code>/src/EF/Bundle/</code>. This overrides the FOSUserBundle for customization.</p>
  
  <pre><code>namespace EF\Bundle\AccountBundle;
  
  use Symfony\Component\HttpKernel\Bundle\Bundle;
  
  class EFAccountBundle extends Bundle
  {
      public function getParent()
      {
          return 'FOSUserBundle';
      }
  }
  </code></pre>
  
  <p>Then, in the path AccountBundle/Form/Type, I am trying to override RegistrationType</p>
  
  <pre><code>namespace EF\Bundle\AccountBundle\Form\Type;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  use FOS\UserBundle\Form\Type\RegistrationFormType as BaseRegistrationFormType;
  
  class UserRegistrationFormType extends BaseRegistrationFormType
  {
      private $class;
  
      /**
       * @param string $class The User class name
       */
      public function __construct($class)
      {
          $this-&gt;class = $class;
      }
  
      /**
       * @param object $builder FormBuilderInterface
       * @param array $options Options that override FOSUserBundle
       */
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          parent::buildForm($builder, $options);
  
          // Adding custom Fields to override FOS User bundle
          $builder
              -&gt;add('firstname', null, array('label' =&gt; 'fos.username', 'translation_domain' =&gt; 'FOSUserBundle'))
          ;
      }
  
      public function setDefaultOptions(OptionsResolverInterface $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; $this-&gt;class,
              'intention'  =&gt; 'registration',
          ));
      }
  
      public function getName()
      {
          return 'ef_account_registration';
      }
  }
  </code></pre>
  
  <p>Added a service on services.xml on AccountBundle/Resources/config as </p>
  
  <pre><code>&lt;!-- src/FOS/UserBundle/Resources/config/registration.xml --&gt;
  &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  
  &lt;container xmlns="http://symfony.com/schema/dic/services"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"&gt;
  
  &lt;services&gt;
  
         &lt;service id="fos_user.registration.form.type" class="EF\Bundle\AccountBundle\Form\Type\UserRegistrationFormType"&gt;
              &lt;tag name="form.type" alias="ef_account_registration" /&gt;
              &lt;argument&gt;%fos_user.model.user.class%&lt;/argument&gt;
          &lt;/service&gt;
    &lt;/services&gt;
  
  &lt;/container&gt;
  </code></pre>
  
  <p>Then made a change in the config file, /app/config/config.yml as </p>
  
  <pre><code>fos_user:
      db_driver: propel # other valid values are 'mongodb', 'couchdb' and 'propel'
      firewall_name: main
      user_class: MH\Security\User
      #user_class: FOS\UserBundle\Propel\User
      registration:
          confirmation:
              enabled: true
          form:
              type: ef_account_registration
  </code></pre>
  
  <p>But i get an error while trying to do register, </p>
  
  <blockquote>
    <p>Could not load type "ef_account_registration" 500 Internal Server
    Error - FormException</p>
  </blockquote>
  
  <p>But if I change the <code>ef_account_registration</code> with <code>fos_user_registration</code>, then it works. Can anyone please help me in this regard?</p>