From 3cc630798b630f66eafe940a9eee7521f1bd9a6e Mon Sep 17 00:00:00 2001 From: Aaron Muylaert Date: Sat, 14 Dec 2013 13:50:46 +0100 Subject: [PATCH] Fix DDC-1787. Credit goes to Jack van Galen for fixing this issue. Fix for JoinedSubclassPersister, multiple inserts with versioning throws an optimistic locking exception. --- lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php b/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php index 684d30571..1fce9c701 100644 --- a/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php +++ b/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php @@ -181,6 +181,10 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister $id = $this->em->getUnitOfWork()->getEntityIdentifier($entity); } + if ($this->class->isVersioned) { + $this->assignDefaultVersionValue($entity, $id); + } + // Execute inserts on subtables. // The order doesn't matter because all child tables link to the root table via FK. foreach ($subTableStmts as $tableName => $stmt) { @@ -212,10 +216,6 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister $stmt->closeCursor(); } - if ($this->class->isVersioned) { - $this->assignDefaultVersionValue($entity, $id); - } - $this->queuedInserts = array(); return $postInsertIds;