From 70603ee3db1afd985d89d56350bd21eedddb03c0 Mon Sep 17 00:00:00 2001 From: Rico Humme Date: Fri, 3 Jun 2016 13:48:05 +0200 Subject: [PATCH] Clear entityInsertions for specific entityName --- lib/Doctrine/ORM/UnitOfWork.php | 7 +++++++ 1 file changed, 7 insertions(+) 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)) {