mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
PreFlush event is triggered on every flush even if already flushed #6564
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 @Seb33300 on GitHub (Nov 12, 2020).
Originally assigned to: @lcobucci on GitHub.
I am encountering an issue where doctrine events are triggered every time the flush method is called, even if the entity was persisted only once.
I am using doctrine 2.7.4 with Symfony 4.4.
Example:
Is it normal that the second flush trigger the event a second time?
I thought it should be triggered only if we persist the entity a second time:
Thank you
@flaushi commented on GitHub (Nov 17, 2020):
The preFlush event only has PreFlushEventArgs, which in turn do not have any entity, only the EntityManager is passed with them. So I think you mixed something up.
@lcobucci commented on GitHub (Nov 20, 2020):
Closing as invalid based on the discussion in #8343