diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-04-12 16:04:17 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-04-12 16:04:17 +0200 |
commit | 624a7c6df1142048cc73770e2c7b7377acd30a9e (patch) | |
tree | 005759ecb04a9d4e41e06a932d67cb295c307159 /src/Wallabag/CoreBundle/Controller | |
parent | 80bd17f00df7691086a47632cefff4ad0e670a44 (diff) | |
download | wallabag-624a7c6df1142048cc73770e2c7b7377acd30a9e.tar.gz wallabag-624a7c6df1142048cc73770e2c7b7377acd30a9e.tar.zst wallabag-624a7c6df1142048cc73770e2c7b7377acd30a9e.zip |
Improve pagination when user has lot of entries
Fix #1905
* Usage of whiteoctober/WhiteOctoberPagerfantaBundle
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index cba58858..e6077707 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -3,7 +3,6 @@ | |||
3 | namespace Wallabag\CoreBundle\Controller; | 3 | namespace Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use Pagerfanta\Adapter\DoctrineORMAdapter; | 5 | use Pagerfanta\Adapter\DoctrineORMAdapter; |
6 | use Pagerfanta\Exception\OutOfRangeCurrentPageException; | ||
7 | use Pagerfanta\Pagerfanta; | 6 | use Pagerfanta\Pagerfanta; |
8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
9 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 8 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
@@ -253,13 +252,7 @@ class EntryController extends Controller | |||
253 | $entries = new Pagerfanta($pagerAdapter); | 252 | $entries = new Pagerfanta($pagerAdapter); |
254 | 253 | ||
255 | $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); | 254 | $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); |
256 | try { | 255 | $entries->setCurrentPage($page); |
257 | $entries->setCurrentPage($page); | ||
258 | } catch (OutOfRangeCurrentPageException $e) { | ||
259 | if ($page > 1) { | ||
260 | return $this->redirect($this->generateUrl($type, array('page' => $entries->getNbPages())), 302); | ||
261 | } | ||
262 | } | ||
263 | 256 | ||
264 | return $this->render( | 257 | return $this->render( |
265 | 'WallabagCoreBundle:Entry:entries.html.twig', | 258 | 'WallabagCoreBundle:Entry:entries.html.twig', |