I am developing an application using Symfony2 and doctrine 2. I would like to know how can I get the currently logged in user\'s Id.
For finding by username:
public function getLoggedUser() { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); return $this->getUser(); }
Then
$this->getLoggedUser()->getUsername() will return the username.