mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Deprecate EntityManager::flush with $entity argument #6621
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 @beberlei on GitHub (Feb 6, 2021).
The method
EntityManager::flushhas an optional argument $entity (either accepting a single entity or array of entities) that when passed are the only set of entities considered in compute changeset operation. The idea originally was to allow more performant flush operations when a lot of entities are in the identity map.However due to restrictions in how the UnitOfWork operates, it had to also "flush" other entities sometimes that were not passed to
flush, making the operation inconsistent.As such we decided to deprecate this approach to flushing and only allow a full flush for now.
Alternative: If you want to keep the set of entities small that flush operates on, you could decide to use the explicit change tracking policy for an entity instead of the implicit one. https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/reference/change-tracking-policies.html