module-doctrine2 icon indicating copy to clipboard operation
module-doctrine2 copied to clipboard

Expose fixture executor to make references available

Open bjo3rnf opened this issue 4 years ago • 0 comments

With returning the ORMExecutor after loading fixtures it is possible to access the ReferenceRepository which in turn allows fetching concrete fixture instances by reference:

/** @var \Doctrine\Common\DataFixtures\ReferenceRepository $repo */
$repo = $I->loadFixtures(Foo::class)->getReferenceRepository();
/** @var Foo $foo */
$foo = $repo->getReference('foo');

which comes in very handy. See the included UnitTest for an example.

Edit: I don't know why Travis fails, local tests don't

bjo3rnf avatar Apr 07 '20 09:04 bjo3rnf