title: How to implement a baseclass for Symfony2 controllers
body: <p>There are some articles around which touch this topic, but none of them seemed to be a practical usable solution for me.
  My goal is to put some basic methods (those I need in each controller anyway) into a basecontroller, e.g.</p>
  
  <pre><code>   $this-&gt;getEntityManager();
     $this-&gt;getRequest();
     $this-&gt;getRepository($entityName);
  </code></pre>
  
  <p>How can this be done?</p>
  
  <p>AFAIK we have to inject the services into the basecontroller, but how do I tell classes to use a service for their superclass?
  There is some decent article about Controllers and Dependency Injection [1], but finally I got stuck with that approach too, see my comment here: [2]</p>
  
  <p>[1] <a href="http://miller.limethinking.co.uk/2011/04/15/symfony2-controller-as-service/">http://miller.limethinking.co.uk/2011/04/15/symfony2-controller-as-service/</a></p>
  
  <p>[2] <a href="http://miller.limethinking.co.uk/2011/04/15/symfony2-controller-as-service/#comment-579">http://miller.limethinking.co.uk/2011/04/15/symfony2-controller-as-service/#comment-579</a></p>