From 4608fe5b3b720b3a920b88a2a4c0fad2090c3276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 5 Dec 2023 21:19:34 +0100 Subject: [PATCH] fix: Avoid sql error on ONLY_FULL_GROUP_BY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Db/CardMapper.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/Db/CardMapper.php b/lib/Db/CardMapper.php index 9e8c3bfd0..a5d5c6f03 100644 --- a/lib/Db/CardMapper.php +++ b/lib/Db/CardMapper.php @@ -171,7 +171,7 @@ public function queryCardsByBoard(int $boardId): IQueryBuilder { public function queryCardsByBoards(array $boardIds): IQueryBuilder { $qb = $this->db->getQueryBuilder(); - $qb->select('c.*') + $qb->selectDistinct('c.*') ->from('deck_cards', 'c') ->innerJoin('c', 'deck_stacks', 's', $qb->expr()->eq('s.id', 'c.stack_id')) ->andWhere($qb->expr()->in('s.board_id', $qb->createNamedParameter($boardIds, IQueryBuilder::PARAM_INT_ARRAY))); @@ -339,7 +339,6 @@ public function search(array $boardIds, SearchQuery $query, int $limit = null, i ); } - $qb->groupBy('c.id'); $qb->orderBy('c.last_modified', 'DESC'); if ($limit !== null) { $qb->setMaxResults($limit); @@ -383,7 +382,6 @@ public function searchComments(array $boardIds, SearchQuery $query, int $limit = $tokenMatching ); - $qb->groupBy('comments.id', 'c.id'); $qb->orderBy('comments.id', 'DESC'); if ($limit !== null) { $qb->setMaxResults($limit);