diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-04-12 16:40:18 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-04-12 16:40:18 +0200 |
commit | 1880da742027ec08f73e116143f2f514155ab7fd (patch) | |
tree | add5f3b5bc2987f7cc33a55048ec733294105d52 /src/Wallabag/CoreBundle/Controller | |
parent | 76cd8dbb059ebec2d0650089424681afc9bd6b0b (diff) | |
download | wallabag-1880da742027ec08f73e116143f2f514155ab7fd.tar.gz wallabag-1880da742027ec08f73e116143f2f514155ab7fd.tar.zst wallabag-1880da742027ec08f73e116143f2f514155ab7fd.zip |
Restore old behavior for OutOfRangeCurrentPageException
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index e6077707..cba58858 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -3,6 +3,7 @@ | |||
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; | ||
6 | use Pagerfanta\Pagerfanta; | 7 | use Pagerfanta\Pagerfanta; |
7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
8 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 9 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
@@ -252,7 +253,13 @@ class EntryController extends Controller | |||
252 | $entries = new Pagerfanta($pagerAdapter); | 253 | $entries = new Pagerfanta($pagerAdapter); |
253 | 254 | ||
254 | $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); | 255 | $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); |
255 | $entries->setCurrentPage($page); | 256 | try { |
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 | } | ||
256 | 263 | ||
257 | return $this->render( | 264 | return $this->render( |
258 | 'WallabagCoreBundle:Entry:entries.html.twig', | 265 | 'WallabagCoreBundle:Entry:entries.html.twig', |