I\'m using FOSUserBundle to authenticate my users.
I\'m trying to get the user object inside the Controller to register a trip where I should add the user object to
public function indexAction() { /* @var $user \FOS\UserBundle\Model\UserInterface */ if ($user = $this->getUser()) { echo ''; print_r($user); print_r($user->getRoles()); // method usage example exit; return $this->redirectToRoute('dashboard'); } return $this->redirectToRoute('login'); }
'; print_r($user); print_r($user->getRoles()); // method usage example exit; return $this->redirectToRoute('dashboard'); } return $this->redirectToRoute('login'); }