mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-2930: Pessimistic locking using $em->find('Entity', $id, LockMode::PESSIMISTIC_WRITE) and $em->lock($entiy, LockMode::PESSIMISTIC_WRITE) differs in (not)refreshing entity state from DB #3645
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jan 23, 2014).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user jkavalik:
When using pessimistic locking on MySQL(InnoDB tables) there is difference which surprised me:
will reload entity state from DB even when entity was already managed in cache (implemented in DDC-2929)
So I supposed that
will work alike even when in this case entity is sure already loaded and managed
But it is not the case, actual query log showed only
If this difference is intended it would be nice to mention it in http://docs.doctrine-project.org/en/latest/reference/transactions-and-concurrency.html
As a workaround I use