aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 5407d065..b3ec7729 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -532,9 +532,11 @@ class EntryController extends Controller
532 $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); 532 $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : '');
533 $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); 533 $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : '');
534 534
535 $sortBy = 'createdAt'; 535 // defined as null by default because each repository method have the right field as default value too
536 if (in_array($request->get('sort', 'createdAt'), ['id', 'createdAt', 'title', 'updatedAt'], true)) { 536 // like `getBuilderForStarredByUser` will have `starredAt` sort by default
537 $sortBy = $request->get('sort', 'createdAt'); 537 $sortBy = null;
538 if (in_array($request->get('sort', 'createdAt'), ['id', 'title', 'createdAt', 'updatedAt', 'starredAt', 'archivedAt'], true)) {
539 $sortBy = $request->get('sort', null);
538 } 540 }
539 541
540 $direction = 'DESC' === $request->get('direction') ? 'DESC' : 'ASC'; 542 $direction = 'DESC' === $request->get('direction') ? 'DESC' : 'ASC';