From ad402c6ded46f0f31766fc651bf5e02b429f7405 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 15 May 2010 11:53:28 +0200 Subject: [PATCH] DDC-178 DQL Optimistic Lock now requires ALL classes to be versioned, otherwise throws exception --- lib/Doctrine/ORM/Query/SqlWalker.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index c0d68829b..8d7dd6259 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -372,16 +372,11 @@ class SqlWalker implements TreeWalker } else if ($lockMode == \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) { $sql .= " " . $this->_platform->getWriteLockSQL(); } else if ($lockMode == \Doctrine\DBAL\LockMode::OPTIMISTIC) { - $versionedClassFound = false; foreach ($this->_selectedClasses AS $class) { - if ($class->isVersioned) { - $versionedClassFound = true; + if (!$class->isVersioned) { + throw \Doctrine\ORM\OptimisticLockException::lockFailed(); } } - - if (!$versionedClassFound) { - throw \Doctrine\ORM\OptimisticLockException::lockFailed(); - } } }