From d00069e38b5563da0f7c8f0221c8086d8d1115b5 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sun, 19 Jun 2016 09:28:12 +0200 Subject: [PATCH] Reverting 741da7806c5d01796e243de9a122590151cb0c90, which was causing issues due to loose type checking See this example on why the revert is needed: https://3v4l.org/8T34v Code copied for reference: ```php lock($entity, $lockMode, $lockVersion); break; - case LockMode::NONE: - case LockMode::PESSIMISTIC_READ: - case LockMode::PESSIMISTIC_WRITE: + case LockMode::NONE === $lockMode: + case LockMode::PESSIMISTIC_READ === $lockMode: + case LockMode::PESSIMISTIC_WRITE === $lockMode: $persister = $unitOfWork->getEntityPersister($class->name); $persister->refresh($sortedId, $entity, $lockMode); break; @@ -439,8 +439,8 @@ use Doctrine\Common\Util\ClassUtils; $persister = $unitOfWork->getEntityPersister($class->name); - switch ($lockMode) { - case LockMode::OPTIMISTIC: + switch (true) { + case LockMode::OPTIMISTIC === $lockMode: if ( ! $class->isVersioned) { throw OptimisticLockException::notVersioned($class->name); } @@ -451,8 +451,8 @@ use Doctrine\Common\Util\ClassUtils; return $entity; - case LockMode::PESSIMISTIC_READ: - case LockMode::PESSIMISTIC_WRITE: + case LockMode::PESSIMISTIC_READ === $lockMode: + case LockMode::PESSIMISTIC_WRITE === $lockMode: if ( ! $this->getConnection()->isTransactionActive()) { throw TransactionRequiredException::transactionRequired(); }