title: Can Doctrine's resolve_target_entities be used for discovering repositories?
body: <p>I'm using Symfony 2.8.3 with Doctrine 2.4.8 on two projects (<strong>ProjectA</strong> and <strong>ProjectB</strong>) and wanted to create a shared service in my bundle (<strong>SharedBundle</strong>).</p>
  
  <p>This service needs to operate on the database so I thought I could use the resolve_target_entities directive in config.yml to gain access to my project's repository (defined in ProjectA and ProjectB) from SharedBundle.</p>
  
  <p>The repository looks like this:</p>
  
  <pre><code>&lt;?php
  
  namespace My\ProjectA\Repository;
  
  class FooRepository extends \Doctrine\ORM\EntityRepository
  {
      // ...
  }
  </code></pre>
  
  <h2>First attempt - interface</h2>
  
  <p>app/config:</p>
  
  <pre><code>doctrine:
      orm:
          # ...
          resolve_target_entities:
              My\SharedBundle\Model\FooInterface: My\ProjectA\Entity\Foo
  </code></pre>
  
  <p>So I've created an interface:</p>
  
  <pre><code>&lt;?php
  
  namespace My\SharedBundle\Model;
  
  interface FooInterface 
  {
  }
  </code></pre>
  
  <p>The entity implements this interface</p>
  
  <pre><code>&lt;?php
  
  namespace My\ProjectA\Entity;
  
  class Foo implements \My\SharedBundle\Model\FooInterface
  {
      // ...
  }
  </code></pre>
  
  <p>Trying to access the repository from SharedService like this:</p>
  
  <pre><code>$repository = $this-&gt;entityManager-&gt;getRepository(\My\SharedBundle\Model\FooInterface::class);
  </code></pre>
  
  <p>This throws:</p>
  
  <p><code>Class 'My\SharedBundle\Model\FooInterface' does not exist</code></p>
  
  <h2>Second attempt - abstract entity</h2>
  
  <p>app/config.yml</p>
  
  <pre><code>doctrine:
      orm:
          # ...
          resolve_target_entities:
              My\SharedBundle\Model\AbstractFoo: My\ProjectA\Entity\Foo
  </code></pre>
  
  <p>I create an abstract entity</p>
  
  <pre><code>&lt;?php
  
  namespace My\SharedBundle\Model;
  
  abstract class AbstractFoo
  {
      // ...
  }
  </code></pre>
  
  <p>Inheritance:</p>
  
  <pre><code>&lt;?php
  
  namespace My\ProjectA\Entity;
  
  class Foo extends AbtractFoo
  {
      // ...
  }
  </code></pre>
  
  <p>Now I wanted to access the repository from SharedService like this:</p>
  
  <pre><code>$repository = $this-&gt;entityManager-&gt;getRepository(\My\SharedBundle\Model\AbstractFoo::class);
  </code></pre>
  
  <p>But this throws:</p>
  
  <p><code>The class 'My\SharedBundle\Model\AbstractFoo' was not found in the chain configured namespaces My\ProjectA\Entity</code></p>
  
  <p>Is this applicable to doctrine relations only?</p>