-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Description
EntityManager#flush($something) is a problematic operation, since it leads to consumers potentially storing incomplete in-memory graphs into the DB.
In general, flush($something) should be used as an optimization, but dealing with it from within the ORM has only led to bugs and massive headaches so far, whereas keeping a smaller UnitOfWork is trivial from the consumer perspective.
Therefore, I suggest dropping this ability completely, while consumers should instead approach batch-processing problems with something like:
- explicit change tracking policy
- use a
TableDataGatewayapproach (TableDataGateway interface for fetching/saving entities without UnitOfWork interactions #5550) - use
EntityManager#clear()more often, especially in combination with aREAD_WRITEsecond level cache region - create new
EntityManagerinstances, and keep them small
oprokidnev, pensiero, pepakriz, chalasr, avo7 and 24 more