[BUGFIX] getQuery should respect orderBy 46/50246/3
authorSusanne Moog <susanne.moog@typo3.com>
Mon, 17 Oct 2016 15:11:32 +0000 (17:11 +0200)
committerBenni Mack <benni@typo3.org>
Mon, 17 Oct 2016 15:36:33 +0000 (17:36 +0200)
ContentObjectRenderer::getQuery now respects orderBy if given.

Change-Id: Ic9e640c8dcfd37815bb7ad1f89f551ad2c360422
Resolves: #78295
Releases: master
Reviewed-on: https://review.typo3.org/50246
Reviewed-by: Tobi Kretschmann <tobi@tobishome.de>
Tested-by: Tobi Kretschmann <tobi@tobishome.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index 781704c..57f299e 100644 (file)
@@ -7536,6 +7536,12 @@ class ContentObjectRenderer
             $queryBuilder->groupBy(...$queryParts['groupBy']);
         }
 
+        if (is_array($queryParts['orderBy'])) {
+            foreach ($queryParts['orderBy'] as $orderBy) {
+                $queryBuilder->addOrderBy(...$orderBy);
+            }
+        }
+
         // Fields:
         if ($conf['selectFields']) {
             $queryBuilder->selectLiteral($this->sanitizeSelectPart($conf['selectFields'], $table));