mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
PersistentCollection::removeElement with fetch EXTRA_LAZY remove from DB without persist&flush #6242
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 @karakum on GitHub (May 31, 2019).
Originally assigned to: @karakum on GitHub.
Bug Report
Summary
This code was added a long-long ago in 2011 year...
356f5874bf (r33750844)Current behavior
$collection->removeElement($el)execute sql DELETE before(without)$em->persist()&$em->flush().How to reproduce
1 Many-to-many collection with
fetch="EXTRA_LAZY"2 Remove element from collection
Expected behavior
There must no DB changes be made without
$em->persist()&$em->flush()@lcobucci commented on GitHub (Oct 2, 2019):
@karakum changes might still happen without
$em->persist(), depending on the tracking policy. However,$em->flush()is a must. Would you be able to send us a functional test reproducing this issue? It would be quite helpful 👍@lcobucci commented on GitHub (Oct 2, 2019):
@karakum never mind my comment, this is apparently the way things are designed to work (TIL!)
@karakum commented on GitHub (Oct 2, 2019):
@lcobucci could you please give me doc-link about this "feature"?
@lcobucci commented on GitHub (Oct 2, 2019):
@karakum unfortunately, there's just no documentation for that: https://github.com/doctrine/orm/issues/7765
Changing this is a BC break but I believe we have to find a solution to overcome what @guilhermeblanco mentioned in the commit and still make this managed by the UoW.