aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller/EntryController.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2020-04-24 16:06:06 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2020-04-28 10:14:46 +0200
commit074110ca2dd3ba0d58f2fa93076933d06b46df77 (patch)
tree42b46f8058f78def2dff488725c9c1c3bed0d63f /src/Wallabag/CoreBundle/Controller/EntryController.php
parent9b5552290445b404e6de0595d7d27a2de824230a (diff)
downloadwallabag-074110ca2dd3ba0d58f2fa93076933d06b46df77.tar.gz
wallabag-074110ca2dd3ba0d58f2fa93076933d06b46df77.tar.zst
wallabag-074110ca2dd3ba0d58f2fa93076933d06b46df77.zip
First draft for tests
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 6e56c237..56759adb 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -532,13 +532,17 @@ class EntryController extends Controller
532 $repository = $this->get('wallabag_core.entry_repository'); 532 $repository = $this->get('wallabag_core.entry_repository');
533 $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); 533 $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : '');
534 $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); 534 $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : '');
535 $direction = (null !== $request->query->get('entry_sort')['sortOrder'] ? $request->query->get('entry_sort')['sortOrder'] : 'asc'); 535 $direction = 'asc';
536
537 // defined as null by default because each repository method have the right field as default value too
538 // like `getBuilderForStarredByUser` will have `starredAt` sort by default
539 $sortBy = null; 536 $sortBy = null;
540 if (\in_array($request->get('entry_sort')['sortType'], ['id', 'title', 'createdAt', 'updatedAt', 'starredAt', 'archivedAt'], true)) { 537
541 $sortBy = $request->get('entry_sort')['sortType']; 538 if (null !== ($request->query->get('entry_sort'))) {
539 $direction = (null !== $request->query->get('entry_sort')['sortOrder'] ? $request->query->get('entry_sort')['sortOrder'] : 'asc');
540
541 // defined as null by default because each repository method have the right field as default value too
542 // like `getBuilderForStarredByUser` will have `starredAt` sort by default
543 if (\in_array($request->get('entry_sort')['sortType'], ['id', 'title', 'createdAt', 'updatedAt', 'starredAt', 'archivedAt'], true)) {
544 $sortBy = $request->get('entry_sort')['sortType'];
545 }
542 } 546 }
543 547
544 switch ($type) { 548 switch ($type) {