title: How can I use the getContainer() in my self-made service
body: <p>I would like to use EntityManager in self-made Service</p>
  
  <p>in my config.yml</p>
  
  <pre><code>services:
      myfunc:
          class:   Acme\TopBundle\MyServices\MyFunc
          arguments: []
  </code></pre>
  
  <p>in Acme\TopBundle\MyServices\MyFunc.php</p>
  
  <pre><code>namespace Acme\TopBundle\MyServices;
  use Doctrine\ORM\EntityManager;
  
  class MyFunc
  {
      public $em;
  
      public function check(){
          $this-&gt;em = $this-&gt;getContainer()-&gt;get('doctrine')-&gt;getEntityManager(); // not work.
  .
  .
  </code></pre>
  
  <p>it shows error when I call method check().</p>
  
  <pre><code>Call to undefined method Acme\TopBundle\MyServices\MyFunc::getContainer()
  </code></pre>
  
  <p>How can I use getContainer() in myFunc class??</p>