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
Adding multiple hasmany/many-many objects has the problem that it will multiply your output. Thus adding a relation with 3 objects to a single parent will return 1 x 3 objects. But adding another relation to your query with 5 objects makes it 1 x 3 x 5 = 15 rows for 9 objects. And it get progressively worse after that.
To solve this subsequent to-many relations could be fetching using an extra query: SELECT .... FROM relation WHERE id IN (parent_id_1, parent_id_2, etc...)
What has to be figured out is how to configure this (seperate method from relation() or a flag in relation method second param array). The current get() method with the relation classes could probably be modified to work with plural objects as well.
It'll probably be a method named include() that includes a relation with the object without joining, while relation() will join a relation on the parent object. If someone has a better name, let me know...
The text was updated successfully, but these errors were encountered:
Adding multiple hasmany/many-many objects has the problem that it will multiply your output. Thus adding a relation with 3 objects to a single parent will return 1 x 3 objects. But adding another relation to your query with 5 objects makes it 1 x 3 x 5 = 15 rows for 9 objects. And it get progressively worse after that.
To solve this subsequent to-many relations could be fetching using an extra query:
SELECT .... FROM relation WHERE id IN (parent_id_1, parent_id_2, etc...)
What has to be figured out is how to configure this (seperate method from
relation()
or a flag in relation method second param array). The currentget()
method with the relation classes could probably be modified to work with plural objects as well.It'll probably be a method named
include()
that includes a relation with the object without joining, whilerelation()
will join a relation on the parent object. If someone has a better name, let me know...The text was updated successfully, but these errors were encountered: