/** * Login User * * @param \Application\Sonata\UserBundle\Entity\User $user */ protected function loginUser(User $user) { $security = $this->get('security.context'); $providerKey = $this->container->getParameter('fos_user.firewall_name'); $roles = $user->getRoles(); $token = new UsernamePasswordToken($user, null, $providerKey, $roles); $security->setToken($token); }
/** * {@inheritDoc} */ public function getRoles() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getRoles', array()); return parent::getRoles(); }