protected function onSuccess(UserInterface $user, $confirmation) { // Note: if you plan on modifying the user then do it before calling the // parent method as the parent method will flush the changes /* @var $user \Projet0\Homepage\LoginBundle\Entity\User */ $group = $this->container->get('doctrine')->getEntityManager()->getRepository('Projet0HomepageLoginBundle:Group')->findOneByName($this->defaultGroup); if ($group) { $user->addGroup($group); } parent::onSuccess($user, $confirmation); // otherwise add your functionality here }