title: Difference between ObjectManager and EntityManager in Symfony2?
body: <p>What's the difference between <code>Doctrine\Common\Persistence\ObjectManager</code> and <code>Doctrine\ORM\EntityManager</code> when using it in a custom form type?</p>
  
  <p>I can get the respository using both <code>$this-&gt;em-&gt;getRepository()</code> and <code>$this-&gt;om-&gt;getRepository()</code>.</p>
  
  <pre><code>class MyFormType extends \Symfony\Component\Form\AbstractType
  {
  
      /**
       * @var Doctrine\ORM\EntityManager
       */
      protected $em;
  
      public function __construct(Doctrine\ORM\EntityManager $em)
      {
          $this-&gt;em = $em;
      }
  
   }
  </code></pre>
  
  <p>Instead of:</p>
  
  <pre><code>class MyFormType extends \Symfony\Component\Form\AbstractType
  {
  
      /**
       * @var Doctrine\Common\Persistence\ObjectManager
       */
      protected $om;
  
      public function __construct(Doctrine\Common\Persistence\ObjectManager $om)
      {
          $this-&gt;om = $om;
      }
  
   }
  </code></pre>