title: How to get doctrine fixture references by type of fixture in test in symfony WebTestCase?
body: <p>I am using doctrine fixtures to load test data in my symfony application. </p>
  
  <pre><code> $this-&gt;fixtureLoader = $this-&gt;loadFixtures([
              "My\DemonBundle\DataFixtures\ORM\LoadEntity1Data",
              "My\DemonBundle\DataFixtures\ORM\LoadEntity2Data",
              "My\DemonBundle\DataFixtures\ORM\LoadEntity3Data",
              "My\DemonBundle\DataFixtures\ORM\LoadEntity4Data",
              "My\DemonBundle\DataFixtures\ORM\LoadEntity5Data",
              'My\DemonBundle\DataFixtures\ORM\LoadEntity6Data'
  ]);
  </code></pre>
  
  <p>In my test case, I want to test get paginated entities. </p>
  
  <pre><code>public function testGetPaginated()
  {
  
      $entities6 = $this-&gt;fixtureLoader-&gt;getReferenceRepository()-&gt;getReferences();
  
      $expected = array_slice($entities6, 3, 3);
  
      $this-&gt;client = static::makeClient();
      $this-&gt;client-&gt;request('GET', '/api/v1/entities6', ["page" =&gt; 2, "limit" =&gt; 3, "order" =&gt; "id", "sort" =&gt; "asc"], array(), array(
          'CONTENT_TYPE' =&gt; 'application/json',
          'HTTP_ACCEPT' =&gt; 'application/json'
      ));
  
  
     $this-&gt;assertSame($expected, $this-&gt;client-&gt;getResponse()-&gt;getContent());
  
  }
  </code></pre>
  
  <p>I want to compare page from my fixtures and from api response. The problem is below line returns all fixture references. The entity I want to test is  of type Entity6. Entity6 has dependency on all other types so I have to load all of them. </p>
  
  <p>$entities = $this->fixtureLoader->getReferenceRepository()->getReferences();</p>
  
  <p>How do I get refernces of type Entity6 only ? I digged into </p>
  
  <p>Doctrine\Common\DataFixtures\ReferenceRepository::getReferences code</p>
  
  <pre><code>/**
   * Get all stored references
   *
   * @return array
   */
  public function getReferences()
  {
      return $this-&gt;references;
  }
  </code></pre>
  
  <p>There is no option to get references of particular type. I tried looping on all references to check the class type using get_class</p>
  
  <pre><code>    foreach ($references as $reference) {
          $class = get_class($obj);
          if ($class == "My\DemonBundle\Entity\ORM\Entity6") {
              $expected[] = $obj;
          }
      }
  </code></pre>
  
  <p>But references are proxy doctrine entitites so I am getting class type </p>
  
  <pre><code>Proxies\__CG__\My\DemonBundle\Entity\ORM\Entity6
  </code></pre>
  
  <p>How do I get references of entity type from doctrine fixtures ? Prefixing Proxies__CG__ might not be best way to do this ? What is the most reliable way ?</p>