Pagerfanta
Pagerfanta copied to clipboard
Can't Add "All" option
Hi.
How can I add a new option "All entries" when in Pagerfanta class we have method like:
private function checkMaxPerPage($maxPerPage)
{
if (!is_int($maxPerPage)) {
throw new NotIntegerMaxPerPageException();
}
if ($maxPerPage < 1) {
throw new LessThan1MaxPerPageException();
}
}
I think, better way and good solution to change private to protected, than we can override this method to add custom logic.
Now I should check in my controller if perPage is string.
Thank You.
Well, having to check it in your code is logical. Passing a string to Pagerfanta will not work because adapters are expecting an integer
Yes, I saw your code. But I think it will be better way when I can override method. Or, maybe, you can use smth like -1 option.
when i set -1 pagerfanta setMaxPerPage to nbResults or smth else.
Thank You.
@SiDz this would mean that adapters would know about this special value in their implementation, which is not the case. So even if you overwrite the Pagerfanta method, you would still be breaking the Pagerfanta contract for adapters, thus breaking them