From 0d72e935f0f22a6ce5414700f2bd2bb24d8836ad Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Tue, 14 Jan 2020 12:00:09 +0100 Subject: [PATCH] [BUGFIX] Fix for sql_mode=only_full_group_by In newer MySQL versions the query in GlossaryRepository::findAllForIndex() will fail if sql_mode contains only_full_group_by. The problem is the ORDER BY clause which does not match the GROUP BY. Resolves: #2 --- Classes/Domain/Repository/GlossaryRepository.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Repository/GlossaryRepository.php b/Classes/Domain/Repository/GlossaryRepository.php index 7e26132..876adc5 100644 --- a/Classes/Domain/Repository/GlossaryRepository.php +++ b/Classes/Domain/Repository/GlossaryRepository.php @@ -21,6 +21,8 @@ class GlossaryRepository extends Repository */ public function findAllForIndex() { + $previousOrderings = $this->defaultOrderings; + $this->defaultOrderings = []; /** @var Query $query */ $query = $this->createQuery(); // Get the query parser via object manager to use dependency injection @@ -30,8 +32,9 @@ public function findAllForIndex() // Add our select and group by $queryBuilder->selectLiteral('substr(' . $queryBuilder->quoteIdentifier('short') . ', 1, 1) AS ' . $queryBuilder->quoteIdentifier('char')) ->groupBy('char'); - - return $query->statement($queryBuilder)->execute(true); + $result = $query->statement($queryBuilder)->execute(true); + $this->defaultOrderings = $previousOrderings; + return $result; } /**