diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 4c343f2ec93..2c9c49b4263 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -1167,6 +1167,10 @@ private function executeInserts(): void $entities = $this->computeInsertExecutionOrder(); foreach ($entities as $entity) { + if (! in_array($entity, $this->entityInsertions, true)) { + continue; + } + $oid = spl_object_id($entity); $class = $this->em->getClassMetadata(get_class($entity)); $persister = $this->getEntityPersister($class->name);