mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-4017: [GH-1569] Add EAGER_BATCHED fetchmode to OneToMany association #4903
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 @doctrinebot on GitHub (Nov 24, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user @doctrinebot:
This issue is created automatically through a Github pull request on behalf of interpotential:
Url: https://github.com/doctrine/doctrine2/pull/1569
Message:
In regular EAGER mode, doctrine adds a JOIN for a OneToMany association
forcing the database to load more data in memory than essentially
needed. In a classic Article => Tag concept, each article would be
loaded one extra time for every addition tag.
LAZY mode issues a query for every article to load all associated tags,
also adding more overhead to the database than needed.
This new fetchmode addreses this issue by loading all tags associated to
an article into one additional query.
@doctrinebot commented on GitHub (Nov 24, 2015):
Comment created by interpotential:
This is a feature I was very much looking for myself. After a lengthy conversation with Elias Van Ootegem on stackoverflow I decided to put the code into a PR to see what others in the Doctrine community think of it.
To be honest, I'm not fully convinced that a fetchmode is the best approach. But it seemed the most stable and predictable. As Elias pointed out, there may be situations where this behaviour is not desired for certain relations so just replacing the eager loading strategy seemed a bad idea.
@Makapashev commented on GitHub (Jan 25, 2021):
That's a huge problem of this ORM, when do you plan to fix this issue? It seems that you decided to avoid creation of this feature.