DDC-178 DQL Optimistic Lock now requires ALL classes to be versioned, otherwise throws exception
This commit is contained in:
parent
10312494f1
commit
ad402c6ded
@ -372,18 +372,13 @@ 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$versionedClassFound) {
|
|
||||||
throw \Doctrine\ORM\OptimisticLockException::lockFailed();
|
throw \Doctrine\ORM\OptimisticLockException::lockFailed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user