Reputation: 191
I want to get the user currently connected to a session. I mean since we can get the role with this :
$this->get('security.context')->isGranted('ROLE_ADMIN')
could we get the user??
Upvotes: 0
Views: 242
Reputation: 11490
you can get the current user like this
$securityContext = $this->get('security.context');
$user = $securityContext->getToken()->getUser();
Upvotes: 3