-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Enhancement: Introduces PagerInterface::isDeterministic
(refs #8164)
#8205
base: 4.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,4 +121,9 @@ public function getThreshold(): int | |
{ | ||
return $this->threshold; | ||
} | ||
|
||
public function isDeterministic(): bool | ||
{ | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is maybe something to compute, because if we are on the last page and there is no next page, we know the exact number of result and we can return true. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds legit. I'll return this dynamically depending on currently known information! |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,7 +186,7 @@ file that was distributed with this source code. | |
<label class="checkbox" for="{{ admin.uniqid }}_all_elements"> | ||
<input type="checkbox" name="all_elements" id="{{ admin.uniqid }}_all_elements"> | ||
{{ 'all_elements'|trans({}, 'SonataAdminBundle') }} | ||
({{ admin.datagrid.pager.countResults() }}) | ||
({{ admin.datagrid.pager.countResults() }}{% if not admin.datagrid.pager.deterministic %}+{% endif %}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the method is not mandatory, we might need an internal twig extension
|
||
</label> | ||
|
||
<select name="action" style="width: auto; height: auto" class="form-control"> | ||
|
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.
This is a good idea but it's a BC break to add a method in an interface.
You have to do like this
SonataAdminBundle/src/Filter/FilterInterface.php
Lines 22 to 25 in 672a614
By just adding a
@method
and it will be mandatory in next major.