Repository navigation
Class-aware access to scheduled operations during onFlush #12782
michelaegue
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We maintain a modular application where several Doctrine listeners use onFlush to process pending changes for specific entity classes.
Each listener currently retrieves the scheduled insertions, updates, or deletions and filters them by class:
When multiple listeners observe different classes, they repeatedly traverse the same scheduled operations. With L independent listeners and N scheduled entities, this can produce approximately L × N filtering work.
Entity listeners already provide class-specific dispatch for individual lifecycle events. Our question concerns operations that require the onFlush phase, after change sets have been computed and while the pending operations are available together. Moving those operations to prePersist, preUpdate, or post events would change their timing and available context.
Would Doctrine consider providing either:
The intended benefit is avoiding repeated classification across independent listeners while preserving the existing flush lifecycle.
Before suggesting an API or implementation, we would appreciate guidance on:
We have not benchmarked a proposed implementation yet. If this direction is considered worthwhile, we could provide a minimal reproducer and benchmarks comparing repeated filtering with shared classification.
All reactions