mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Object hash in UoW #6217
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 @sweiguny on GitHub (Apr 9, 2019).
Originally assigned to: @Ocramius on GitHub.
Question
Hello,
I have some questions about the internals of Doctrine, which are primarily for my understanding.
The
UnitOfWorkhas a collection of all entities under management and therefore also a list of their states (private $entityStates = [];). Here is an assignment of a new Entity. As you can see there, the object hash is taken as key and the value is the state ("managed").Isn't somewhere the primary key of the entity checked, too?
Because, if only the object hash is checked, I can clone my entity which gives me another object hash, pass it to
EntityManager::persist()and have basically the same entity twice in theUnitOfWork.Or did I miss something?
Thank you in advance for your answer.