New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make pagination limit configurable globally #105
Comments
It would be nice |
I propose to change this interface in 2.0 to interface PaginatorInterface
{
function paginate($target): PaginationInterface;
function withPage(int $page): PaginatorInterface
function withLimit(int $limit): PaginatorInterface
function withOptions(array $options): PaginatorInterface
} Where in default implementation:
ping @polc |
You can open a PR on branch 2.0 if change is BC-breaking (like changing interfaces). |
I thought there will be more time until release of 2.0, now it's too late to do BC breaking change |
If this issue is still relevant I can open PR to add |
It's still relevant. At the same time, I'm not sure what you plan to do. If you add it to $options, it will ignore limit specified in $page. |
Default limit value will be set in $defaultOptions, not hardcoded in function itself.
|
currently pagination limit default value is harcoded in function declaration https://github.com/KnpLabs/knp-components/blob/master/src/Knp/Component/Pager/Paginator.php#L83
however passing
$limit = null
cause exception:https://github.com/KnpLabs/knp-components/blob/master/src/Knp/Component/Pager/Paginator.php#L87
this is a problem when im trying to set options like this:
$paginator->paginate($query, 1, null, array(...));
basically this construction force me to specify proper
$limit
every time i callpaginate()
it would be much better if
$limit
was in$defaultOptions
as this way i could set$limit
on one place (in Symfony2 it would be config.yml) globally for every paginator.The text was updated successfully, but these errors were encountered: