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.
In symfony2, we can get this simpler by this code:
$id = $this->getUser()->getId();