Skip to content

Commit cb3e872

Browse files
author
Dariusz Prząda
committed
$this->otherKey renamed to $this->ownerKey to fix this error: Jenssegers\Mongodb\Relations\BelongsTo::$otherKey
1 parent 53ee79f commit cb3e872

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Jenssegers/Mongodb/Relations/BelongsTo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function addConstraints()
1111
// For belongs to relationships, which are essentially the inverse of has one
1212
// or has many relationships, we need to actually query on the primary key
1313
// of the related models matching on the foreign key that's on a parent.
14-
$this->query->where($this->otherKey, '=', $this->parent->{$this->foreignKey});
14+
$this->query->where($this->ownerKey, '=', $this->parent->{$this->foreignKey});
1515
}
1616
}
1717

@@ -25,7 +25,7 @@ public function addEagerConstraints(array $models)
2525
// We'll grab the primary key name of the related models since it could be set to
2626
// a non-standard name and not "id". We will then construct the constraint for
2727
// our eagerly loading query so it returns the proper models from execution.
28-
$key = $this->otherKey;
28+
$key = $this->ownerKey;
2929

3030
$this->query->whereIn($key, $this->getEagerModelKeys($models));
3131
}

0 commit comments

Comments
 (0)