mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Deprecate EntityManager::clear with argument of one entity class and EntityRepository::clear #6623
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).
It is possible to call
EntityManager::clear($entity)orEntityRepository::clear()to only clear one kind of entity from the identity map. this is done by calling detach on the entity instead of actually clearing the identity map and other relatedUnitOfWorkdata.Because clearing is not semantically the same as detaching an entity, it is not possible to do this anymore.
Alternative: If you need to detach many entities, you can perform this operation directly using the UnitOfWork. Potentially hide this away in a service or repository:
@gempir commented on GitHub (Jun 21, 2021):
The documentation for batch processing will need an update then
https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/batch-processing.html#iterating-results
@derrabus commented on GitHub (May 11, 2022):
Fixed via #9471.