title: Doctrine Repository getEntityManager() does returns empty
body: <p>I have an application I am coding with Symfony2.  I have created an Account entity and used the annotation to create a repository called AccountRepository  Inside the AccountRepository object I have created a function to run some business logic that goes out to an outside vendor and creates a user at their site, and returns the information back to us so I can associate their user with our Account Entity.  Part of creating that user includes sending over credit card token.  They then return some limited credit card data I want to store and associate with our account so I have an entity AccountCard after creating the object and inserting the appropriate data, I am unable to request the entity manager from the repository and persist the AccountCard doing a print_r on the $em variable shows nothing, yet everything I've read tells me I should be able to do this.  What am I doing wrong?</p>
  
  <pre><code>&lt;?php
  
  namespace Openbridge\CommonBundle\Entity\Repository;
  
  use Doctrine\ORM\EntityRepository;
  
  use Openbridge\CommonBundle\Entity\Account as Account;
  use Openbridge\CommonBundle\Entity\AccountCard as AccountCard;
  use Openbridge\CommonBundle\Entity\AccountAddress as AccountAddress;
  
  /**
   * AccountRepository
   *
   * This class was generated by the Doctrine ORM. Add your own custom
   * repository methods below.
   */
  class AccountRepository extends EntityRepository
  {
      public function __construct()
      {
  
      }
  
      function createVendorUser(Account $account, $userData = array())
      {
          // Request new user from vendor code here. (this works)
  
          $ac = new AccountCard();
          // setters for $ac data here.
  
          // Get entity manager
          $em = $this-&gt;getEntityManager();
          $em-&gt;persist($ac);
          $em-&gt;flush();
      }
  </code></pre>