From 4e92404a3e9345036b9b7f918454fd90a365d867 Mon Sep 17 00:00:00 2001 From: Jerzy Lekowski Date: Mon, 11 May 2020 09:39:57 +0100 Subject: [PATCH] Fix (bug #1862): Do not clear entity manager for doctrine orm populator (#1995) 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;