title: Calling Doctrine from custom class
body: <p>/<em>Edited</em>/</p>
  
  <p>I have this class:</p>
  
  <pre><code>namespace Baza\BlogBundle\Form;   
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Doctrine\ORM\EntityManager; 
  
  class filterType extends AbstractType
  {
  
    protected $em;
    public function __construct(EntityManager $em)
   {
       $this-&gt;em = $em;
   }
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
  
     $this-&gt;$em-&gt;getDoctrine()-&gt;getEntityManager();
  
     /****
     ****/
  
   }
  }
  </code></pre>
  
  <p>And this is my services yml:</p>
  
  <pre><code>services:
   filterType:
      class: Baza\BlogBundle\Form\filterType
      arguments: [doctrine.orm.entity_manager]
  </code></pre>
  
  <p>When I run the code I get following exception:</p>
  
  <blockquote>
    <p>Catchable Fatal Error: Argument 1 passed to Baza\BlogBundle\Form\filterType::__construct() must be an instance of Doctrine\ORM\EntityManager, none given</p>
  </blockquote>
  
  <p>I'm all out of ideas.</p>