mirror of
https://github.com/doctrine/orm.git
synced 2026-04-29 09:23:20 +02:00
DDC-3839: EventListener not called when clearing a ManyToMany collection by reference #4702
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 @doctrinebot on GitHub (Jul 20, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user jgoncalves:
I have an issue with a ManyToMany relation. I don't know if it is a bug or the normal behaviour but when I clear a ManyToMany relation of an entity with the following code :
the event listener linked to my entity is not called when I flush the entity manager.
I have updated the test \Doctrine\Tests\ORM\Functional\ManyToManyEventTest in order to reproduce the issue (see file attached).
@doctrinebot commented on GitHub (Sep 1, 2015):
Comment created by jgoncalves:
Hi, any news about that? Is it an issue or a misunderstanding of how it should work?
@tmarly commented on GitHub (Aug 27, 2018):
+1, I still have the pb (sf4 / doctrine orm 2.7-dev).
The pb:
e7a6d87990that call listener only if isDirty=trueFor information, I'm not using directly the function clear(), however I'm using sf forms, and the form listener calls clear()
++
@beberlei commented on GitHub (Feb 16, 2020):
Scheduled this for the next bug release, because it sounds really weird. Can't promise it really gets investigated though
@skylord123 commented on GitHub (Dec 5, 2020):
This is a duplicate of #4173
The event doesn't get called because when you clear a PersistentCollection it takes a snapshot which marks the collection as not dirty.