Skip to content
Permalink
Browse files

Fixes #7591

  • Loading branch information...
lorenzo committed Dec 6, 2015
1 parent 1f4a428 commit 25417ec0ba421f03db694c03f586fb8a0b43f23f
Showing with 16 additions and 10 deletions.
  1. +0 −2 src/ORM/Association.php
  2. +16 −8 src/ORM/EagerLoader.php
@@ -771,13 +771,11 @@ protected function _bindNewAssociations($query, $surrogate, $options)
$loader = $surrogate->eagerLoader();
$contain = $loader->contain();
$matching = $loader->matching();
$target = $this->_targetTable;
if (!$contain && !$matching) {
return;
}
$loader->attachAssociations($query, $target, $options['includeFields']);
$newContain = [];
foreach ($contain as $alias => $value) {
$newContain[$options['aliasPath'] . '.' . $alias] = $value;
@@ -334,14 +334,22 @@ public function attachAssociations(Query $query, Table $repository, $includeFiel
return;
}
foreach ($this->attachableAssociations($repository) as $loadable) {
$config = $loadable->config() + [
'aliasPath' => $loadable->aliasPath(),
'propertyPath' => $loadable->propertyPath(),
'includeFields' => $includeFields,
];
$loadable->instance()->attachTo($query, $config);
}
$attachable = $this->attachableAssociations($repository);
$processed = [];
do {
foreach ($attachable as $alias => $loadable) {
$config = $loadable->config() + [
'aliasPath' => $loadable->aliasPath(),
'propertyPath' => $loadable->propertyPath(),
'includeFields' => $includeFields,
];
$loadable->instance()->attachTo($query, $config);
$processed[$alias] = true;
}
$newAttachable = $this->attachableAssociations($repository);
$attachable = array_diff_key($newAttachable, $processed);
} while ($attachable);
}
/**

0 comments on commit 25417ec

Please sign in to comment.
You can’t perform that action at this time.