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
When you now try to include the cees relation with this package's QueryBuilder, attributes that are present in B (intermediate) AND C (target) are overwritten by the attributes of the intermediate model B.
However, when I manually eager-load the relation by passing the relation name to the normal Builder's with() function, nothing is overwritten.
So far I did not have the time to dive deeper into the package, but I assume it internally builds a custom query to load the includes, which is not correct in the specific case of hasManyThrough relations.
I would appreciate to tell me if this issue can be reproduced.
Edit: I am now sure the problem lies in the select * statement that is appended via closure if no fields are explicitly specified in Spatie\QueryBuilder\addIncludesToQuery(). Probably prefixing it with the correct table name like table.* could do the trick.
Assume you have three tables/models
A
,B
andC
.On
A
you define ahasManyThrough
relation like this:When you now try to include the
cees
relation with this package's QueryBuilder, attributes that are present inB
(intermediate) ANDC
(target) are overwritten by the attributes of the intermediate modelB
.However, when I manually eager-load the relation by passing the relation name to the normal Builder's
with()
function, nothing is overwritten.So far I did not have the time to dive deeper into the package, but I assume it internally builds a custom query to load the includes, which is not correct in the specific case of
hasManyThrough
relations.I would appreciate to tell me if this issue can be reproduced.
Edit: I am now sure the problem lies in the select
*
statement that is appended via closure if no fields are explicitly specified inSpatie\QueryBuilder\addIncludesToQuery()
. Probably prefixing it with the correct table name liketable.*
could do the trick.I think #118 would fix this issue.
The text was updated successfully, but these errors were encountered: