diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index a66d7b462..0b71372e3 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -2401,6 +2401,13 @@ class UnitOfWork implements PropertyChangedListener $this->doDetach($entity, $visited, false); } } + + foreach ($this->entityInsertions as $hash => $entity) { + if (get_class($entity) != $entityName) { + continue; + } + unset($this->entityInsertions[$hash]); + } } if ($this->evm->hasListeners(Events::onClear)) {