Commit ad402c6d authored by Benjamin Eberlei's avatar Benjamin Eberlei

DDC-178 DQL Optimistic Lock now requires ALL classes to be versioned, otherwise throws exception

parent 10312494
...@@ -372,16 +372,11 @@ class SqlWalker implements TreeWalker ...@@ -372,16 +372,11 @@ class SqlWalker implements TreeWalker
} else if ($lockMode == \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) { } else if ($lockMode == \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) {
$sql .= " " . $this->_platform->getWriteLockSQL(); $sql .= " " . $this->_platform->getWriteLockSQL();
} else if ($lockMode == \Doctrine\DBAL\LockMode::OPTIMISTIC) { } else if ($lockMode == \Doctrine\DBAL\LockMode::OPTIMISTIC) {
$versionedClassFound = false;
foreach ($this->_selectedClasses AS $class) { foreach ($this->_selectedClasses AS $class) {
if ($class->isVersioned) { if (!$class->isVersioned) {
$versionedClassFound = true; throw \Doctrine\ORM\OptimisticLockException::lockFailed();
} }
} }
if (!$versionedClassFound) {
throw \Doctrine\ORM\OptimisticLockException::lockFailed();
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment