Skip to content

Commit

Permalink
fixes wrong foreignKey to find the association
Browse files Browse the repository at this point in the history
was using the foreignKey for the source table ("foreignKey") and not the foreignKey for the target table ("targetForeignKey")
  • Loading branch information
TheFRedFox committed May 24, 2016
1 parent 625a9b4 commit c8b6000
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ORM/Association/BelongsToMany.php
Expand Up @@ -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);
Expand Down

0 comments on commit c8b6000

Please sign in to comment.