Skip to content

Commit

Permalink
fixed has many though relationship
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed Aug 18, 2024
1 parent 5649282 commit e4459d6
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 e4459d6

Please sign in to comment.