mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Delayed fetch eager #6982
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 @antman3351 on GitHub (May 20, 2022).
Feature Request
Summary
Hi,
Would it be possible to implement a delayed fetch eager for a query ?
The idea is, for a result of a query all associations are eager loaded but only when accessed ( a mix between lazy and eager ).
I have some use cases where the used associations are read at runtime ( user defined exports / print templates ).
Because the data is being listed in a table format if the association is accessed once, it will be accessed for all the rows so eager loading the association would be best.
But because the templates are defined by the user, the association may also never be accessed, so eager loading all the associations is over-kill.
Also this would prevent the issue when in a "listing" view an associated column is added without adding FETCH_EAGER to the query possibly creating performance issues.
@derrabus commented on GitHub (May 20, 2022):
I believe this would be difficult to implement, but if you want to give it a shot, go ahead.
@beberlei commented on GitHub (May 27, 2022):
There is a PR for this called #8391 where I discuss that this could replace fetch eager.
@antman3351 commented on GitHub (May 27, 2022):
Super! I'll close this then 👍