Developing my Symfony2 application, i would like to, kind of like in Ruby on Rails, to have methods available in all controllers. In RoR controllers simply inherit after ApplicationController
and that is where you put all the methods. But what is the Symfony way, what is good practice here?
Functionality I want is very simple actually, something similar to this:
public function showAction()
{
$user = $this->container->get('security.context')->getToken()->getUser();
}
I can load current user here, and I would like this function to be terminated before every action, without, of course, copying the code into every single controller.