-
-
Notifications
You must be signed in to change notification settings - Fork 465
Support unlimited pagination results when first is -1 or negative #2739
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
base: master
Are you sure you want to change the base?
Support unlimited pagination results when first is -1 or negative #2739
Conversation
Support negative `first` argument to disable pagination limits, improving query efficiency over large arbitrary limit workarounds.
spawnia
left a comment
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.
I can not even begin to consider inclusion due to the total lack of tests. Before you write any, let's discuss the issue of null vs negative values for first.
| <?php | ||
|
|
||
| declare(strict_types=1); |
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.
Formatting is off here and messed up in other places.
src/Pagination/PaginationArgs.php
Outdated
| ? 'simplePaginate' | ||
| : 'paginate'; | ||
|
|
||
| if ($methodName == 'paginate' && $this->first < 0) { |
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.
first: null seems much cleaner to me. Negative values could be the result of unchecked arithmetic errors, whereas null is much more explicit and discrete.
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.
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.
Support null `first` argument to disable pagination limits, improving query efficiency over large arbitrary limit workarounds.



Support negative
firstargument to disable pagination limits, improving query efficiency over large arbitrary limit workarounds.Resolves #2734
Changes
Introduced a simple NegativePerPageLengthAwarePaginator