Skip to content

Commit

Permalink
Fixed #3109
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jul 18, 2018
1 parent 1be4ca6 commit 5e07acb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes for Craft CMS 3.x

## Unreleased

### Fixed
- Fixed a bug where the `orderBy` element query param wasn’t being respected when used in conjunction with a `with` param to eager-load elements in a specific order. ([#3109](https://github.com/craftcms/cms/issues/3109))

## 3.0.16 - 2018-07-17

### Added
Expand Down
5 changes: 4 additions & 1 deletion src/services/Elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,10 @@ public function eagerLoadElements(string $elementType, array $elements, $with)
$targetPath = $sourcePath . '.' . $segment;

// Figure out the path mapping wants a custom order
$useCustomOrder = !empty($pathCriterias[$targetPath]['order']);
$useCustomOrder = (
!empty($pathCriterias[$targetPath]['orderBy']) ||
!empty($pathCriterias[$targetPath]['order'])
);

// Make sure we haven't already eager-loaded this target path
if (!isset($elementsByPath[$targetPath])) {
Expand Down

0 comments on commit 5e07acb

Please sign in to comment.