title: Symfony2 - Methods for all controllers
body: <p>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 <code>ApplicationController</code> and that is where you put all the methods. But what is the Symfony way, what is good practice here?</p>
  
  <p>Functionality I want is very simple actually, something similar to this:</p>
  
  <pre><code>public function showAction()
  {
      $user = $this-&gt;container-&gt;get('security.context')-&gt;getToken()-&gt;getUser();
  }
  </code></pre>
  
  <p>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.</p>