-
-
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
deprecate PagerInterface::getNbResults() in favour of countResults() #6732
Conversation
e6090d0
to
913b9b0
Compare
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.
When I saw the implementation of the getNbResult/SetNbResult
I start to think that we should
- Deprecate
getNbResult
,setNbResult
like you did ; but alsonbResult
. - Not implementing
countResults
in the abstract Pager
Then, every Pager will have his own implementation.
- SimplePager have a
countResults
without the need of the property or the setter. - DoctrineORM may use a property and a setter to cache the value
- Another Persistence bundle can do it differently.
WDYT ?
return $this->getMaxPerPage() && $this->getNbResults() > $this->getMaxPerPage(); | ||
// NEXT_MAJOR: remove the existence check and the else part | ||
if (method_exists($this, 'countResults')) { | ||
$countResults = (int) $this->countResults(); |
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.
$countResults = (int) $this->countResults(); | |
$countResults = $this->countResults(); |
This is not needed, isn't it?
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.
See #6732 (comment)
411f844
to
c190a3d
Compare
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.
All we need now is to update UPGRADE-3.x.md to list the deprecated things and to explain that countResults should be implemented
Co-authored-by: Javier Spagnoletti <[email protected]>
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.
Thank you @dmaicher 🤗
thanks @dmaicher, can you please take also a look at these calls? https://github.com/sonata-project/SonataAdminBundle/search?l=Twig&q=NbResults |
Ah I missed those 😕 Will check later today and create a follow-up PR 👍 |
DoctrineORMAdminBundle Datagrid Pager has a missing method: |
@michanismus this was fixed but not released yet: sonata-project/SonataDoctrineORMAdminBundle#1257 |
@dmaicher I saw, but not merged into 4.x-dev yet... |
Subject
I am targeting this branch, because its BC.
Closes #6710
Changelog