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
This commit is contained in:
Jeremy Benoist 2017-06-01 09:29:16 +02:00
parent 2a0eec07a5
commit 53da8ad844
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
3 changed files with 4 additions and 7 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);