Skip to content

Commit

Permalink
fixed #2717
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Apr 10, 2018
1 parent 19107f2 commit 0367bf8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed
- Fixed an error that occurred when saving a Single entry over Ajax. ([#2687](https://github.com/craftcms/cms/issues/2687))
- Fixed a bug where the `id` param was ignored when used on an eager-loaded elements’ criteria. ([#2717](https://github.com/craftcms/cms/issues/2717))

## 2.6.3015 - 2018-04-06

Expand Down
9 changes: 8 additions & 1 deletion src/services/ElementsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,14 @@ public function eagerLoadElements(BaseElementType $elementType, $elements, $with
(isset($pathCriterias[$targetPath]) ? $pathCriterias[$targetPath] : array())
);
$criteria = $this->getCriteria($map['elementType'], $customParams);
$criteria->id = $uniqueTargetElementIds;
if ($criteria->id)
{
$criteria->id = array_intersect((array)$criteria->id, $uniqueTargetElementIds);
}
else
{
$criteria->id = $uniqueTargetElementIds;
}
$targetElements = $this->findElements($criteria);

if ($targetElements)
Expand Down

0 comments on commit 0367bf8

Please sign in to comment.