From 3769042556aeea59c63605a4d05e497ed6fc11b0 Mon Sep 17 00:00:00 2001 From: Uladzimir Tsykun Date: Sat, 14 Sep 2024 20:38:18 +0200 Subject: [PATCH] Fix sql error on suggesters page --- src/Repository/PackageRepository.php | 3 +-- tests/Functional/Controller/BaseAclControllerTest.php | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Repository/PackageRepository.php b/src/Repository/PackageRepository.php index 28baeafe..45b3a4cf 100644 --- a/src/Repository/PackageRepository.php +++ b/src/Repository/PackageRepository.php @@ -451,12 +451,11 @@ public function getSuggestCount($name) public function getSuggests($name, $offset = 0, $limit = 15) { - $sql = 'SELECT p.id, p.name, p.description, p.language, p.abandoned, p.replacementPackage + $sql = 'SELECT DISTINCT p.id, p.name, p.description, p.language, p.abandoned, p.replacementPackage FROM link_suggest s INNER JOIN package_version pv ON (pv.id = s.version_id AND pv.development = true) INNER JOIN package p ON (p.id = pv.package_id) WHERE s.packageName = :name - GROUP BY pv.package_id ORDER BY p.name ASC LIMIT ' . ((int)$limit) . ' OFFSET ' . ((int)$offset); $stmt = $this->getEntityManager()->getConnection() diff --git a/tests/Functional/Controller/BaseAclControllerTest.php b/tests/Functional/Controller/BaseAclControllerTest.php index 00763e13..997d9156 100644 --- a/tests/Functional/Controller/BaseAclControllerTest.php +++ b/tests/Functional/Controller/BaseAclControllerTest.php @@ -71,6 +71,7 @@ public static function adminUrlProvider(): array ['/'], ['/packages/okvpn/cron-bundle'], ['/packages/okvpn/cron-bundle/stats'], + ['/packages/okvpn/cron-bundle/suggesters'], ['/packages/submit'], ['/users/'], ['/users/dev'],