Closed jseriff closed 8 years ago
Hey @jseriff. I looked into this today. I haven't finished fixing it because I was quite busy and there's another complicated problem that surfaced underneath this one. Will try to get it fixed soon though :) Half-fixed on my local atm.
Your sample program now runs correctly, and does the most efficient queries we can without joins.
SELECT * FROM "test_schema"."parents";
[]
load rels models.Parent [Children Thirds]
!loaded Children
loadChildren!
select * from "test_schema"."children" where "parent_id" in ($1,$2)
[1 2]
collection type models.ChildSlice
load rels models.Child [Thirds]
!loaded Thirds
loadThirds!
select * from "test_schema"."third" where "children_id" in ($1,$2,$3)
[1 2 3]
I'm not ultra-confident this will work in all cases because my tests are a bit weak because I ran out of time tonight. Might revise this later. Will fix your other bug tomorrow. Do you mind trying the new code? :)
Fixed tests and one more bug this morning.
This issue appears to be solved on dev. Thanks!
When attempting a multi-level eager load, I am seeing a reflection error. Here is a reproduction case:
I constructed a simple 3 level hierarchy to show this error:
Generated the models on this schema, and then ran a the following code:
I receive the following error:
I spent a few minutes looking into loadRelationships - it looks like when it recurses, the loadRelationshipsRecurse method is expecting to receive the "Children"'s R, but instead receives the "Parent"s R, which does not have a Thirds member.