[RFC] Make UnitOfWork and BasicEntityPersister more override-friendly #6875

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

Originally created by @outtersg on GitHub (Nov 14, 2021).

Feature Request

Q A
New Feature yes
RFC yes
BC Break no

Summary

Ease BasicEntityPersister overriding by:

  1. unhardcoding it in UnitOfWork
  2. having an executeDeletions() in EntityPersisters (putting the loop over entities in the EP instead of in the UOW)

The end goal being to plug optimized (driver- or application-specific) EntityPersisters to handle some or all entities of a project.

Details

Point 2. is specifically to allow easy multidelete (letting the EntityPersister group deletes as DELETE FROM table WHERE id IN (?, ?, ?, ?, ?)).
(which requires a driver-specific implementation, e.g. array_chunk for Oracle and its 1000-items limit in INs)
And it would make executeDeletions() symetric to executeInserts() (where UOW calls EntityPersister's one, letting EP optimize by grouping or doing individual calls)

Point 1. would allow two plugging modes:

  • either individual entity classes to declare themselves ready for MassEntityPersister (via an opt-in annotation)
  • or a project-wide switch to make UOW greedily use the MassEntityPersister wherever possible
Originally created by @outtersg on GitHub (Nov 14, 2021). ### Feature Request | Q | A |------------ | ------ | New Feature | yes | RFC | yes | BC Break | no #### Summary Ease BasicEntityPersister overriding by: 1. unhardcoding it in UnitOfWork 2. having an executeDeletions() in EntityPersisters (putting the loop over entities in the EP instead of in the UOW) The end goal being to plug optimized (driver- or application-specific) EntityPersisters to handle some or all entities of a project. #### Details Point 2. is specifically to allow easy multidelete (letting the EntityPersister group deletes as ``DELETE FROM table WHERE id IN (?, ?, ?, ?, ?)``). (which requires a driver-specific implementation, e.g. array_chunk for Oracle and its 1000-items limit in ``IN``s) And it would make executeDeletions() symetric to executeInserts() (where UOW calls EntityPersister's one, letting EP optimize by grouping or doing individual calls) Point 1. would allow two plugging modes: - either individual entity classes to declare themselves ready for MassEntityPersister (via an opt-in annotation) - or a project-wide switch to make UOW greedily use the MassEntityPersister wherever possible
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6875