From 49b60635014e422ac94a9825087b405ddc1676cd Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 12 Feb 2023 13:35:05 +0100 Subject: [PATCH] Fix ordering on Postgres --- module/Core/src/Tag/Repository/TagRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/Core/src/Tag/Repository/TagRepository.php b/module/Core/src/Tag/Repository/TagRepository.php index 825a4249..740a79ae 100644 --- a/module/Core/src/Tag/Repository/TagRepository.php +++ b/module/Core/src/Tag/Repository/TagRepository.php @@ -107,8 +107,8 @@ class TagRepository extends EntitySpecificationRepository implements TagReposito ->select( 't.id_0 AS id', 't.name_1 AS name', - 'v.visits', - 'v2.non_bot_visits', + 'COALESCE(v.visits, 0) AS visits', // COALESCE required for postgres to properly order + 'COALESCE(v2.non_bot_visits, 0) AS non_bot_visits', // COALESCE required for postgres to properly order 'COUNT(DISTINCT s.id) AS short_urls_count', ) ->from('(' . $subQb->getQuery()->getSQL() . ')', 't') // @phpstan-ignore-line