From ae8bdc81977abf8c7e988231d8cae43f50b43914 Mon Sep 17 00:00:00 2001 From: afishnamedsquish Date: Mon, 12 Nov 2012 14:03:53 -0500 Subject: [PATCH] Update src/Faker/ORM/Doctrine/Populator.php Moved $entityManager->flush() to be called at the end of each loop that creates entities of specific class to allow for the population of entity data that has associations to other entities which are being created earlier in the execution. --- src/Faker/ORM/Doctrine/Populator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Faker/ORM/Doctrine/Populator.php b/src/Faker/ORM/Doctrine/Populator.php index 216c1f37..ec8923c2 100644 --- a/src/Faker/ORM/Doctrine/Populator.php +++ b/src/Faker/ORM/Doctrine/Populator.php @@ -62,8 +62,8 @@ class Populator for ($i=0; $i < $number; $i++) { $insertedEntities[$class][]= $this->entities[$class]->execute($entityManager, $insertedEntities); } + $entityManager->flush(); } - $entityManager->flush(); return $insertedEntities; }