File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -496,7 +496,7 @@ public function load(Model $model)
496
496
if ($ this ->through )
497
497
{
498
498
// verify through is a belongs_to or has_many for access of keys
499
- if (!($ through_relationship = $ this -> get_table ()->get_relationship ($ this ->through )))
499
+ if (!($ through_relationship = $ model -> table ()->get_relationship ($ this ->through )))
500
500
throw new HasManyThroughAssociationException ("Could not find the association $ this ->through in model " . get_class ($ model ));
501
501
502
502
if (!($ through_relationship instanceof HasMany) && !($ through_relationship instanceof BelongsTo))
@@ -508,8 +508,7 @@ public function load(Model $model)
508
508
509
509
$ this ->set_keys ($ this ->get_table ()->class ->getName (), true );
510
510
511
- $ class = $ this ->class_name ;
512
- $ relation = $ class ::table ()->get_relationship ($ this ->through );
511
+ $ relation = $ model ::table ()->get_relationship ($ this ->through );
513
512
$ through_table = $ relation ->get_table ();
514
513
$ this ->options ['joins ' ] = $ this ->construct_inner_join_sql ($ through_table , true );
515
514
You can’t perform that action at this time.
0 commit comments