1
0
mirror of synced 2024-12-14 07:06:04 +03:00

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

This commit is contained in:
Benjamin Eberlei 2010-05-15 11:53:28 +02:00
parent 10312494f1
commit ad402c6ded

View File

@ -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();
}
}
}