From 8d2527ec528d1631be21967137f63d2fc0cf218f Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 28 Jun 2016 14:59:31 +0200 Subject: Start work on sort function. Backend is ready. Needs tests and proper UI --- src/Wallabag/CoreBundle/Controller/EntryController.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 9b2954e7..cef29990 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -532,24 +532,27 @@ class EntryController extends Controller $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); + $sortBy = $request->get('sort', 'id'); + $direction = $request->get('direction', 'DESC'); + switch ($type) { case 'search': $qb = $repository->getBuilderForSearchByUser($this->getUser()->getId(), $searchTerm, $currentRoute); break; case 'untagged': - $qb = $repository->getBuilderForUntaggedByUser($this->getUser()->getId()); + $qb = $repository->getBuilderForUntaggedByUser($this->getUser()->getId(), $sortBy, $direction); break; case 'starred': - $qb = $repository->getBuilderForStarredByUser($this->getUser()->getId()); + $qb = $repository->getBuilderForStarredByUser($this->getUser()->getId(), $sortBy, $direction); break; case 'archive': - $qb = $repository->getBuilderForArchiveByUser($this->getUser()->getId()); + $qb = $repository->getBuilderForArchiveByUser($this->getUser()->getId(), $sortBy, $direction); break; case 'unread': - $qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId()); + $qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId(), $sortBy, $direction); break; case 'all': - $qb = $repository->getBuilderForAllByUser($this->getUser()->getId()); + $qb = $repository->getBuilderForAllByUser($this->getUser()->getId(), $sortBy, $direction); break; default: throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); -- cgit v1.2.3