diff options
author | Sébastien Viande <sviande@gmail.com> | 2018-04-26 07:20:52 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-09-21 10:33:33 +0200 |
commit | 0e70e812274a4e13b02e821e8a64a3206c7688ec (patch) | |
tree | ff7ff8db96bfac776ab5e4c6abd2f7b2b9a3f06e | |
parent | 7975395d10bb381de8cd15b5ee15198318af6d55 (diff) | |
download | wallabag-0e70e812274a4e13b02e821e8a64a3206c7688ec.tar.gz wallabag-0e70e812274a4e13b02e821e8a64a3206c7688ec.tar.zst wallabag-0e70e812274a4e13b02e821e8a64a3206c7688ec.zip |
Entry: add sort parameter archived
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/EntryRestController.php | 2 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index dc63b98d..5882aaee 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php | |||
@@ -79,7 +79,7 @@ class EntryRestController extends WallabagRestController | |||
79 | * parameters={ | 79 | * parameters={ |
80 | * {"name"="archive", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by archived status."}, | 80 | * {"name"="archive", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by archived status."}, |
81 | * {"name"="starred", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by starred status."}, | 81 | * {"name"="starred", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by starred status."}, |
82 | * {"name"="sort", "dataType"="string", "required"=false, "format"="'created' or 'updated', default 'created'", "description"="sort entries by date."}, | 82 | * {"name"="sort", "dataType"="string", "required"=false, "format"="'created' or 'updated' or 'archived', default 'created'", "description"="sort entries by date."}, |
83 | * {"name"="order", "dataType"="string", "required"=false, "format"="'asc' or 'desc', default 'desc'", "description"="order of sort."}, | 83 | * {"name"="order", "dataType"="string", "required"=false, "format"="'asc' or 'desc', default 'desc'", "description"="order of sort."}, |
84 | * {"name"="page", "dataType"="integer", "required"=false, "format"="default '1'", "description"="what page you want."}, | 84 | * {"name"="page", "dataType"="integer", "required"=false, "format"="default '1'", "description"="what page you want."}, |
85 | * {"name"="perPage", "dataType"="integer", "required"=false, "format"="default'30'", "description"="results per page."}, | 85 | * {"name"="perPage", "dataType"="integer", "required"=false, "format"="default'30'", "description"="results per page."}, |
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 83379998..c0818ca0 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -189,6 +189,8 @@ class EntryRepository extends EntityRepository | |||
189 | $qb->orderBy('e.id', $order); | 189 | $qb->orderBy('e.id', $order); |
190 | } elseif ('updated' === $sort) { | 190 | } elseif ('updated' === $sort) { |
191 | $qb->orderBy('e.updatedAt', $order); | 191 | $qb->orderBy('e.updatedAt', $order); |
192 | } else if ('archived' === $sort) { | ||
193 | $qb->orderBy('e.archivedAt', $order); | ||
192 | } | 194 | } |
193 | 195 | ||
194 | $pagerAdapter = new DoctrineORMAdapter($qb, true, false); | 196 | $pagerAdapter = new DoctrineORMAdapter($qb, true, false); |