title: Symfony2-How to use access a service from outside of a controller
body: <p>In my Symfony2 controller, this works fine:</p>
  
  <pre class="lang-php prettyprint-override"><code>$uploadManager = $this-&gt;get('upload.upload_manager');
  </code></pre>
  
  <p><strong>but when I move it to a custom Listener:</strong></p>
  
  <pre class="lang-php prettyprint-override"><code>use Doctrine\ORM\Event\LifecycleEventArgs;
  use Acme\UploadBundle\Upload\UploadManager;
  
  class PersonChange
  {
      public function postRemove(LifecycleEventArgs $args)
      {
          $entity = $args-&gt;getEntity();
          $entityManager = $args-&gt;getEntityManager();
  
          $uploadManager = $this-&gt;get('ep_upload.upload_manager');
          echo "the upload dir is " . $uploadManager-&gt;getUploadDir();
      }
  }
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>Fatal error: Call to undefined method Acme\MainBundle\Listener\PersonChange::get() in /home/frank/...
  </code></pre>
  
  <p>I know I must need a use statement but don't know what to use.</p>