X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FRepository%2FEntryRepository.php;h=8b6cf443efdb2441fa602950739b959aa482fa83;hb=5419a8368ebb4b4d57f481b842f1fcc576c9149d;hp=93c630c00162412229f1c1705ea1c4d133895445;hpb=b878be4cc99fd4927c70b59386cf7a57b33bb381;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 93c630c0..8b6cf443 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -142,7 +142,7 @@ class EntryRepository extends EntityRepository * * @return Pagerfanta */ - public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'ASC', $since = 0, $tags = '') + public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'asc', $since = 0, $tags = '') { $qb = $this->createQueryBuilder('e') ->leftJoin('e.tags', 't') @@ -185,6 +185,10 @@ class EntryRepository extends EntityRepository } } + if (!\in_array(strtolower($order), ['asc', 'desc'], true)) { + throw new \Exception('Order "' . $order . '" parameter is wrong, allowed: asc or desc'); + } + if ('created' === $sort) { $qb->orderBy('e.id', $order); } elseif ('updated' === $sort) {