Skip to content

Commit

Permalink
Temporarily removing the original fix for issue #8485
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Aug 6, 2016
1 parent d785d98 commit 7b1f14a
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/ORM/Association/BelongsToMany.php
Expand Up @@ -468,15 +468,8 @@ protected function _buildResultMap($fetchQuery, $options)
$property
));
}
$junctionData = $result[$property];
$result[$this->_junctionProperty] = $result[$property];

// Account for incorrectly nested data from hasMany
// bindings when junction tables have additional associations loaded
if (isset($result[$property][0])) {
$junctionData = $result[$property][0];
}
$result[$this->_junctionProperty] = $junctionData;
unset($result[$property]);

if ($hydrated) {
$result->dirty($this->_junctionProperty, false);
Expand Down Expand Up @@ -1289,13 +1282,7 @@ protected function _buildQuery($options)
->where($this->junctionConditions())
->select($query->aliasFields((array)$assoc->foreignKey(), $name));

// If this hasMany attaches any other containments, then the junction
// table is queried twice. Ideally the EagerLoader could resolve the duplication,
// and merge the resulting eagerloadable instances.
//
// We have to define aliasPath, so any nested contains will work.
$assoc->attachTo($query, ['aliasPath' => $assoc->alias()]);

$assoc->attachTo($query);
return $query;
}

Expand Down

0 comments on commit 7b1f14a

Please sign in to comment.