From 53da8ad844b379ab9d82f2497cc5de91da9a1388 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 1 Jun 2017 09:29:16 +0200 Subject: [PATCH] Page parameter was never used in the function It could have been used if we set the current page inside PreparePagerForEntries. But we did that in each controller because we can have an OutOfRangeCurrentPageException --- src/Wallabag/CoreBundle/Controller/EntryController.php | 3 +-- src/Wallabag/CoreBundle/Controller/TagController.php | 3 +-- src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php | 5 ++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 8d2ac6d4c..9fe3e6937 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -321,8 +321,7 @@ class EntryController extends Controller $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); - $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries') - ->prepare($pagerAdapter, $page); + $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter); try { $entries->setCurrentPage($page); diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 736eb1dc0..9422bae43 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -125,8 +125,7 @@ class TagController extends Controller $pagerAdapter = new ArrayAdapter($entriesByTag); - $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries') - ->prepare($pagerAdapter, $page); + $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter); try { $entries->setCurrentPage($page); diff --git a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php index 7d3798b95..df579ebdc 100644 --- a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php +++ b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php @@ -20,16 +20,15 @@ class PreparePagerForEntries /** * @param AdapterInterface $adapter - * @param int $page * * @return null|Pagerfanta */ - public function prepare(AdapterInterface $adapter, $page = 1) + public function prepare(AdapterInterface $adapter) { $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; if (null === $user || !is_object($user)) { - return null; + return; } $entries = new Pagerfanta($adapter);