Find a way to allow calling EntityManager::flush() from within running commit phases #7229

Open
opened 2026-01-22 15:47:34 +01:00 by admin · 0 comments
Owner

Originally created by @mpdude on GitHub (Oct 10, 2023).

This is a follow-up to #10900 and this comment.

It should be possible and allowed for users to call flush() from within event listeners that are being called while a flush() is being processed. We consider it to be a reasonable use case to e. g. add additional entities from within event listeners.

TODO

  • Add tests covering this behaviour
  • Work out what that means for events emitted – e. g. do we want to issue preFlush multiple times?
Originally created by @mpdude on GitHub (Oct 10, 2023). This is a follow-up to #10900 and [this comment](https://github.com/doctrine/orm/pull/10900#issuecomment-1754786565). It should be possible and allowed for users to call `flush()` from within event listeners that are being called while a `flush()` is being processed. We consider it to be a reasonable use case to e. g. add additional entities from within event listeners. #### TODO - [ ] Add tests covering this behaviour - [ ] Work out what that means for events emitted – e. g. do we want to issue `preFlush` multiple times?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7229