Skip to content

Commit

Permalink
Merge pull request #889 from MasoniteFramework/hotfix/fix-has_many_th…
Browse files Browse the repository at this point in the history
…rough

fixed has many though relationship
  • Loading branch information
josephmancuso committed Sep 1, 2024
2 parents 0d0411f + a43ed0e commit 15eca45
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/masoniteorm/relationships/HasManyThrough.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ def apply_query(self, distant_builder, intermediary_builder, owner):
dict -- A dictionary of data which will be hydrated.
"""
# select * from `countries` inner join `ports` on `ports`.`country_id` = `countries`.`country_id` where `ports`.`port_id` is null and `countries`.`deleted_at` is null and `ports`.`deleted_at` is null
distant_builder.join(
result = distant_builder.join(
f"{self.intermediary_builder.get_table_name()}",
f"{self.intermediary_builder.get_table_name()}.{self.foreign_key}",
"=",
f"{distant_builder.get_table_name()}.{self.other_owner_key}",
)
).get()

return self
return result

def relate(self, related_model):
return self.distant_builder.join(
Expand Down

0 comments on commit 15eca45

Please sign in to comment.