php - get the current user in the controller symfony2 -


i want user connected session. mean since can role :

$this->get('security.context')->isgranted('role_admin') 

could user??

you can current user this

$securitycontext = $this->get('security.context'); $user = $securitycontext->gettoken()->getuser(); 

Comments