X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FController%2FEntryController.php;fp=src%2FWallabag%2FCoreBundle%2FController%2FEntryController.php;h=b3ec7729e673f87a5d2435558842797933905c37;hb=e70e383378fc38f8154d482a247a0d2ca23a4925;hp=5407d06578780227fe4a18eacc8b69463955e057;hpb=eb7b632ee6f898dbe5c861623f59fa62fc4d5235;p=github%2Fwallabag%2Fwallabag.git 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 $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); - $sortBy = 'createdAt'; - if (in_array($request->get('sort', 'createdAt'), ['id', 'createdAt', 'title', 'updatedAt'], true)) { - $sortBy = $request->get('sort', 'createdAt'); + // defined as null by default because each repository method have the right field as default value too + // like `getBuilderForStarredByUser` will have `starredAt` sort by default + $sortBy = null; + if (in_array($request->get('sort', 'createdAt'), ['id', 'title', 'createdAt', 'updatedAt', 'starredAt', 'archivedAt'], true)) { + $sortBy = $request->get('sort', null); } $direction = 'DESC' === $request->get('direction') ? 'DESC' : 'ASC';