-
-
Notifications
You must be signed in to change notification settings - Fork 878
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
feature: fix #696 - add an maximum configurable number for client pagination #706
feature: fix #696 - add an maximum configurable number for client pagination #706
Conversation
1da6f61
to
3a79d24
Compare
Hi @bwegrzyn, could you please test this PR and tell me if it's what you wanted to achieve ? |
Can't this be implemented using a custom event listener validating the page parameter? |
With your current implementation, the maximum number of items per page cannot be disabled anymore. |
@dunglas This can be implemented using a custom event listener, but do we have to ? |
Maybe can you allow a null value for this parameter? |
|
||
public function __construct(ManagerRegistry $managerRegistry, RequestStack $requestStack, ResourceMetadataFactoryInterface $resourceMetadataFactory, bool $enabled = true, bool $clientEnabled = false, bool $clientItemsPerPage = false, int $itemsPerPage = 30, string $pageParameterName = 'page', string $enabledParameterName = 'pagination', string $itemsPerPageParameterName = 'itemsPerPage', int $maximumItemPerPage = 300) | ||
public function __construct(ManagerRegistry $managerRegistry, RequestStack $requestStack, ResourceMetadataFactoryInterface $resourceMetadataFactory, bool $enabled = true, bool $clientEnabled = false, bool $clientItemsPerPage = false, int $itemsPerPage = 30, string $pageParameterName = 'page', string $enabledParameterName = 'pagination', string $itemsPerPageParameterName = 'itemsPerPage', int $maximumItemPerPage = 300, bool $maximumItemPerPageEnabled = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you just change the signature to int $maximumItemPerPage = null
(and it will be disabled when null
is passed).
0a8eb74
to
e6b9323
Compare
@dunglas comments addressed |
Great work, thanks! Can you just fix the ne Scrutinizr issue please? |
e6b9323
to
bd74767
Compare
…en client is allowed to set item per page
a0fa54e
to
d677cc7
Compare
Pr updated |
Thanks Hamza! |
…r client pagination (api-platform#706)
This PR give the possibility to limit the number of items that the client can see on the same page.