Skip to content

getNbPages should return 1 when there is no result #88

LouTerrailloune opened this Issue Apr 26, 2013 · 0 comments

1 participant


Assuming the current page is set to 1 by default, and that setCurrentPage(1) is allowed when there is no result, I think getNbPages should also return 1 when there is no result.

I think there is always 1 page (even an empty one).

I'm asking this because I use something like this:

$pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages()));

Where $page is coming from the request. If there is no result, I get a LessThan1CurrentPageException.

At least, $pagerfanta->setCurrentPage($pagerfanta->getNbPages()); should work flawlessly even if there is no result.

@pablodip pablodip closed this in 5777eff May 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.