em->wrapInTransaction(static function () use ($executor) { $executor->purge(); }); } foreach ($fixtures as $fixture) { $this->em->wrapInTransaction(static function (EntityManagerInterface $em) use ($executor, $fixture) { $executor->load($em, $fixture); }); } } }