mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
removeElement method doesn't remove element on EXTRA_LAZY collection #5977
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 @yurybykov on GitHub (May 30, 2018).
Originally assigned to: @Ocramius on GitHub.
Bug Report
| Version | v2.6.1
Current behavior
The element of collection is not removed. If it check collection element's count, it won't change.
How to reproduce
Retrive parent entity from DB. Try to remove element from property (that collection).
$entity->some_collection->removeElement($element).
Expected behavior
removeElement must remove element from collection.
@flaushi commented on GitHub (Oct 10, 2018):
I have almost the same problem currently. But for me the removal does work (databasewise), but the postUpdate event is not triggered, see https://github.com/doctrine/doctrine2/issues/7426
@flaushi commented on GitHub (Oct 11, 2018):
BTW, you did call
$em->flush()after removing, did you?@Ocramius commented on GitHub (Oct 15, 2018):
Closing here due to missing tests: from what I can see, this is a possible (typical) owning/inverse side misconception.
This call only works when combined with
Doctrine\ORM\EntityManager#flush()and if thesome_collectionis the owning side.See also https://gist.github.com/Ocramius/3121916