diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2019-01-14 22:24:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-14 22:24:40 +0100 |
commit | f6b9e883c01196d5aec249f6e8e02e07d0da4089 (patch) | |
tree | 904be517d033438c36b29d2b5c3227f630455b0a /src/Wallabag/CoreBundle | |
parent | f083836cc483fea10302a598b0c14cd515d3d0a3 (diff) | |
parent | 78e3fafa3fab86638295fe1ee2a05a559bf56ab1 (diff) | |
download | wallabag-f6b9e883c01196d5aec249f6e8e02e07d0da4089.tar.gz wallabag-f6b9e883c01196d5aec249f6e8e02e07d0da4089.tar.zst wallabag-f6b9e883c01196d5aec249f6e8e02e07d0da4089.zip |
Merge pull request #3841 from wallabag/fix/bad-order-api
Fix bad order parameter in the API
Diffstat (limited to 'src/Wallabag/CoreBundle')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 83379998..cebce714 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -142,7 +142,7 @@ class EntryRepository extends EntityRepository | |||
142 | * | 142 | * |
143 | * @return Pagerfanta | 143 | * @return Pagerfanta |
144 | */ | 144 | */ |
145 | public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'ASC', $since = 0, $tags = '') | 145 | public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'asc', $since = 0, $tags = '') |
146 | { | 146 | { |
147 | $qb = $this->createQueryBuilder('e') | 147 | $qb = $this->createQueryBuilder('e') |
148 | ->leftJoin('e.tags', 't') | 148 | ->leftJoin('e.tags', 't') |
@@ -185,6 +185,10 @@ class EntryRepository extends EntityRepository | |||
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | if (!\in_array(strtolower($order), ['asc', 'desc'], true)) { | ||
189 | throw new \Exception('Order "' . $order . '" parameter is wrong, allowed: asc or desc'); | ||
190 | } | ||
191 | |||
188 | if ('created' === $sort) { | 192 | if ('created' === $sort) { |
189 | $qb->orderBy('e.id', $order); | 193 | $qb->orderBy('e.id', $order); |
190 | } elseif ('updated' === $sort) { | 194 | } elseif ('updated' === $sort) { |