You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I stumbled upon how useless the EntityManager#lock() method is in scenarios where you need up-to-date data during transaction.
Now the way to go is to use $entity = $em->find($entity->id, LockMode::PESSIMISTIC_WRITE);
It would be nice and more readable if we would allow to call EntityManager#refresh() and specify lockMode to acquire a lock on already loaded entity whilst making sure we have the latest version of it at runtime.
Q
A
New Feature
yes
RFC
no
BC Break
no
Summary
I would like to extend the EntityManager#refresh() to:
publicfunction refresh($entity, $lockMode = null)
This will require similar change to UnitOfWork#refresh() signature, but otherwise should be a simple feature to implement.
What do you think?
The text was updated successfully, but these errors were encountered:
Feature Request
Recently I stumbled upon how useless the
EntityManager#lock()
method is in scenarios where you need up-to-date data during transaction.Now the way to go is to use
$entity = $em->find($entity->id, LockMode::PESSIMISTIC_WRITE);
It would be nice and more readable if we would allow to call
EntityManager#refresh()
and specify lockMode to acquire a lock on already loaded entity whilst making sure we have the latest version of it at runtime.Summary
I would like to extend the
EntityManager#refresh()
to:This will require similar change to
UnitOfWork#refresh()
signature, but otherwise should be a simple feature to implement.What do you think?
The text was updated successfully, but these errors were encountered: