Jira issue originally created by user @doctrinebot:
This issue is created automatically through a Github pull request on behalf of dyangrev:
We recently saw the postUpdate event get trigger multiple time incorrectly, it typically happens when flushing a set of entities persisted whose listener persist and flush another type of entity in it.
Php passes variables to foreach by value, for the function executeUpdates in the UnitOfWork, for example, entities in the $this->entityUpdates could be updated and unset in the listener of the first entity, while them will be updated and trigger listeners again when the process of first entity finishes (although they have already been unset from $this->entityUpdates). Similar for executeInsertion and executeDeletion.
Comment created by @doctrinebot:
A related Github Pull-Request [GH-989] was closed:
Issue was closed with resolution "Invalid"