How to get doctrine fixture references by type of fixture in test in symfony WebTestCase? How to get doctrine fixture references by type of fixture in test in symfony WebTestCase? symfony symfony

How to get doctrine fixture references by type of fixture in test in symfony WebTestCase?


Don't use get_class, use instanceof:

foreach ($references as $reference) {    if ($reference instanceof \My\DemonBundle\Entity\ORM\Entity6) {        $expected[] = $obj;    }}

Doctrine proxies inherit the entity class, thus fulfilling instanceof.