From fccd92497a91979f74d2094dbb2ce9a8a6d4aa9e Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Tue, 28 Jan 2020 11:17:54 +0100 Subject: [PATCH] Added last check on ShortUrlsOrdering which makes sure everything keeps behaving as it used to --- module/Core/src/Model/ShortUrlsOrdering.php | 5 +++++ module/Core/src/Repository/ShortUrlRepository.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/module/Core/src/Model/ShortUrlsOrdering.php b/module/Core/src/Model/ShortUrlsOrdering.php index a98ad99a..00c30a54 100644 --- a/module/Core/src/Model/ShortUrlsOrdering.php +++ b/module/Core/src/Model/ShortUrlsOrdering.php @@ -60,4 +60,9 @@ final class ShortUrlsOrdering { return $this->orderDirection; } + + public function hasOrderField(): bool + { + return $this->orderField !== null; + } } diff --git a/module/Core/src/Repository/ShortUrlRepository.php b/module/Core/src/Repository/ShortUrlRepository.php index a41f99a8..cd96acfc 100644 --- a/module/Core/src/Repository/ShortUrlRepository.php +++ b/module/Core/src/Repository/ShortUrlRepository.php @@ -40,7 +40,7 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI } // In case the ordering has been specified, the query could be more complex. Process it - if ($orderBy !== null) { + if ($orderBy !== null && $orderBy->hasOrderField()) { return $this->processOrderByForList($qb, $orderBy); }