title: FOSUserBundle adding a group to the user wont do anything
body: <p>I am using FOSuser with SonataUserBundle and I am trying to add a user to the Clients group everytime someone registers, but it doesnt work. I dont get any errors, but I am not adding the group either... I tried it in two ways:</p>
  
  <p>1) I overwritten the registrationController and made the confirmAction save the new group like this:</p>
  
  <pre><code>    /**
       * Tell the user his account is now confirmed
       */
      public function confirmedAction()
      {
       $repository = $em-&gt;getRepository('ApplicationSonataUserBundle:Group');
          $group = $repository-&gt;findOneByName('Clients');
          $em = $this-&gt;getDoctrine()-&gt;getEntityManager();
          $user = $this-&gt;getUser();
          $user-&gt;addGroup($group);
          $this-&gt;em-&gt;flush();
          $userManager = $this-&gt;get('fos_user.user_manager');
          $userManager-&gt;updateUser($user);
      }
  }
  </code></pre>
  
  <p>2)  Icreated an eventListener and made the groupping there:</p>
  
  <pre><code>&lt;?php
  
  namespace Application\Sonata\UserBundle\EventListener;
  
  use FOS\UserBundle\FOSUserEvents;
  use FOS\UserBundle\Event\FormEvent;
  use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  use Doctrine\ORM\EntityManager;
  
  /**
   * Listener responsible to change the redirection at the end of the password resetting
   */
  class GrouppingListener implements EventSubscriberInterface
  {
      protected $em;
      protected $user;
  
      public function __construct(EntityManager $em)
      {
          $this-&gt;em = $em;
      }
  
      /**
       * {@inheritDoc}
       */
      public static function getSubscribedEvents()
      {
          return array(
              FOSUserEvents::REGISTRATION_SUCCESS =&gt; 'onRegistrationSuccess',
          );
      }
  
      public function onRegistrationSuccess(FormEvent $event)
      {
          $this-&gt;user = $event-&gt;getForm()-&gt;getData();
          $entity = $this-&gt;em-&gt;getRepository('ApplicationSonataUserBundle:Group')-&gt;findOneByName('Clients'); // You could do that by Id, too
          $this-&gt;user-&gt;addGroup($entity);
          $this-&gt;em-&gt;flush();
  
      }
  }
  </code></pre>
  
  <p>My group entity is being extended like this:</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\BaseGroup as BaseGroup;
  
  /**
   * 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 Group extends BaseGroup
  {
      /**
       * @var integer $id
       */
      protected $id;
  
      /**
       * Get id
       *
       * @return integer $id
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  }
  </code></pre>
  
  <p>None of these options worked... I did this based on other stackoverflow answers...Why wont it work?</p>