diff --git a/src/ORM/Association/BelongsToMany.php b/src/ORM/Association/BelongsToMany.php index 538adb66997..337f7cb37e1 100644 --- a/src/ORM/Association/BelongsToMany.php +++ b/src/ORM/Association/BelongsToMany.php @@ -894,7 +894,7 @@ public function find($type = null, array $options = []) $belongsTo = $this->junction()->association($this->target()->alias()); $conditions = $belongsTo->_joinCondition([ - 'foreignKey' => $this->foreignKey() + 'foreignKey' => $this->targetForeignKey() ]); $conditions += $this->junctionConditions(); return $this->_appendJunctionJoin($query, $conditions);