From 35a803197b5193e426cc89f5aac309a0910f6f4c Mon Sep 17 00:00:00 2001 From: Jerzy Lekowski Date: Sat, 9 May 2020 14:55:30 +0100 Subject: [PATCH] Fix (bug #1862): Do not clear entity manager for doctrine orm populator Bug: https://github.com/fzaninotto/Faker/issues/1862 Clear specific entities is deprecated and will not be supported in Doctrine 3.0. (https://github.com/doctrine/orm/commit/9ccb8837e7f0bc605117024561c07e487a57eca0) Bug introduced: c49cd5438655043b487f4d986961746ae58edb3a Related issue: https://stackoverflow.com/questions/18215975/doctrine-a-new-entity-was-found-through-the-relationship --- src/Faker/ORM/Doctrine/Populator.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Faker/ORM/Doctrine/Populator.php b/src/Faker/ORM/Doctrine/Populator.php index d4c5dfb879..bd55f0b81b 100644 --- a/src/Faker/ORM/Doctrine/Populator.php +++ b/src/Faker/ORM/Doctrine/Populator.php @@ -98,11 +98,9 @@ public function execute($entityManager = null) ); if (count($insertedEntities) % $this->batchSize === 0) { $entityManager->flush(); - $entityManager->clear($class); } } $entityManager->flush(); - $entityManager->clear($class); } return $insertedEntities;