Skip to content

Commit

Permalink
Using Association::find() in Association::attachTo()
Browse files Browse the repository at this point in the history
This allows us to use defined custom finders even for joinable associations.
Removed unit tests that were hard to follow and were fragile, the code
they covered is also covered by a few integration tests.
  • Loading branch information
lorenzo committed Aug 22, 2014
1 parent 06f727e commit b82a09f
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 1,017 deletions.
3 changes: 1 addition & 2 deletions src/ORM/Association.php
Expand Up @@ -433,7 +433,6 @@ public function attachTo(Query $query, array $options = []) {
'type' => empty($options['matching']) ? $this->joinType() : 'INNER',
'table' => $target->table()
];
$options['conditions'] = array_merge($this->conditions(), $options['conditions']);

if (!empty($options['foreignKey'])) {
$joinCondition = $this->_joinCondition($options);
Expand All @@ -442,7 +441,7 @@ public function attachTo(Query $query, array $options = []) {
}
}

$dummy = $target->query()->eagerLoaded(true);
$dummy = $this->find()->eagerLoaded(true);
if (!empty($options['queryBuilder'])) {
$dummy = $options['queryBuilder']($dummy);
if (!($dummy instanceof Query)) {
Expand Down

0 comments on commit b82a09f

Please sign in to comment.