. */ namespace Doctrine\ORM; /** * An OptimisticLockException is thrown when a version check on an object * that uses optimistic locking through a version field fails. * * @author Roman Borschel * @since 2.0 */ class OptimisticLockException extends ORMException { private $entity; public function __construct($msg, $entity) { $this->entity = $entity; } /** * Gets the entity that caused the exception. * * @return object */ public function getEntity() { return $this->entity; } public static function lockFailed($entity) { return new self("The optimistic lock on an entity failed.", $entity); } }