You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of eagerLoad does not allow that multiple objects have the same has_one relation.
If I have a relation like in the yaml file below, the eager query will load all required EagerLoadBars but will only pass the object into the last EagerLoadFoo object, all objects before will trigger an additional query to the database.
tests\EagerLoadBar:
bar1:
Dummy: 1bar2:
Dummy: 2bar3:
Dummy: 3bar4:
Dummy: 4tests\EagerLoadFoo:
foo1:
Bar: =>tests\EagerLoadBar.bar1foo2:
Bar: =>tests\EagerLoadBar.bar2foo3:
Bar: =>tests\EagerLoadBar.bar1foo4:
Bar: =>tests\EagerLoadBar.bar3foo5:
Bar: =>tests\EagerLoadBar.bar2foo6:
Bar: =>tests\EagerLoadBar.bar4
The text was updated successfully, but these errors were encountered:
beerbohmdo
changed the title
Eager loading with multiple objects pointing to the same has_one trigger extra db fetch
BUG Eager loading with multiple objects pointing to the same has_one trigger extra db fetch
Mar 5, 2024
Module version(s) affected
5.1.18
Description
The current implementation of eagerLoad does not allow that multiple objects have the same has_one relation.
If I have a relation like in the yaml file below, the eager query will load all required
EagerLoadBar
s but will only pass the object into the lastEagerLoadFoo
object, all objects before will trigger an additional query to the database.Is this wanted?
How to reproduce
Possible Solution
Modify the
DataList::fetchEagerLoadHasOne
to store multiple IDs per Relation.Additional Context
No response
Validations
silverstripe/installer
(with any code examples you've provided)PRs
The text was updated successfully, but these errors were encountered: