Skip to content
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 getResults in favor of getCurrentPageResults #6760

Merged

Conversation

VincentLanglet
Copy link
Member

Subject

I am targeting this branch, because BC.

I just discover that

count($pager->getResults()) !== $pager->countResults()

And I think it's misleading.

getResults is returning the results of the current page, so I think it's better to rename this function.

I also close #6620

Changelog

### Added
- Added `PagerInterface::getCurrentPageResults()`

### Deprecated
- Added `PagerInterface::getResults()`

src/Datagrid/PagerInterface.php Outdated Show resolved Hide resolved
@SonataCI
Copy link
Collaborator

Could you please rebase your PR and fix merge conflicts?

dmaicher
dmaicher previously approved these changes Jan 11, 2021
phansys
phansys previously approved these changes Jan 11, 2021
@VincentLanglet VincentLanglet requested review from franmomu and a team January 11, 2021 18:24
@VincentLanglet VincentLanglet merged commit f9fa149 into sonata-project:3.x Jan 12, 2021
@@ -940,7 +940,23 @@ protected function initializeIterator()
), E_USER_DEPRECATED);
}

$this->results = $this->getResults();
if (method_exists($this, 'getCurrentPageResults')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NEXT_MAJOR comment is missing here

@VincentLanglet VincentLanglet deleted the getCurrentPageResults branch March 27, 2021 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return iterable instead of array in PagerInterface::getResults
6 participants