title: How can I add the Entity Manager to a custom class or service?
body: <p>In Symfony2, how can I go about adding Doctrine's entity manager to a custom class or service?</p>
  
  <p>I have tried <code>$em = $this-&gt;get("doctrine.orm.entity_manager");</code>
  and <code>$em = $this-&gt;getDoctrine()-&gt;getEntityManager();</code></p>
  
  <p>Both failed, which led me to try and extend the Controller class with my custom class/service, and that died in a giant ball of fire.</p>