mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #8081] [Docs] Make clear that calling remove() detaches the object #10797
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?
Original Pull Request: https://github.com/doctrine/orm/pull/8081
State: closed
Merged: Yes
I changed a relationship from eager to lazy loading which broke the behavior of my application in regards to object removal. It was not clear for me that removing an object detaches it and subsequent calls like contains() in a OneToMany relationship, with the object scheduled for removal, will return false afterwards. This together with a lazy loaded relation might lead to unexpected behavior.
Example:
In combination with the Symfony Entity Generator it gets more confusing, since it provides a useful
removeEventfunction in the user object. This checks with acontain()if the object is there and does nothing otherwise.Feel free to change the text to make the problem more clear, thanks!