Do not require an active transaction for LockMode::NONE in Query::setLockMode()#12516
Do not require an active transaction for LockMode::NONE in Query::setLockMode()#12516ruudk wants to merge 1 commit into
LockMode::NONE in Query::setLockMode()#12516Conversation
…LockMode() LockMode::NONE means "no lock", so it does not need an active transaction. EntityManager::checkLockRequirements() already only enforces a transaction for the pessimistic lock modes, but Query::setLockMode() also rejected NONE outside a transaction, making the two inconsistent. Fixes doctrine#9499
|
I find it weird that If you have time to dig into why, please do. |
|
You're right that it was deliberate, not a forgotten exclusion. The reason is just long gone. It was added in #932 ( Two things killed that rationale since:
Current SQLServer So |
|
Maybe @BenMorel wants to chip in 😊 Thanks 🙏 |
|
I think that Line 338 in ed636b7 LockMode::None is used?
|
|
Maybe yes. Try removing it, and if nothing break then it's probably the right thing to do. |
|
@ruudk Thank you for pinging me. I agree with this change: my DBAL PR, plus this one on the ORM (which was closed due to inactivity but I believe is still relevant today), were heading in the same direction. |
LockMode::NONEmeans "no lock", so it does not need an active transaction.EntityManager::checkLockRequirements()already only enforces a transaction for the pessimistic lock modes, butQuery::setLockMode()also rejected NONE outside a transaction, making the two inconsistent.Fixes #9499