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

hardly depend on a Page object to make the pager iterable #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

docteurklein
Copy link
Contributor

@docteurklein docteurklein commented Nov 9, 2016

Ease construction of a pager object via Pager::fromResult.

I changed the way the Pager depends on Page. Now you have to pas it a Page instance,
but it eases the end-to-end usage: you only have to use Pager::fromResult($result, $page, $numberPerPage)
and you have a fully iterable pager:

$pager = Pager::fromResult($result, $pageNumber, 10); // $page = 5

var_dump($pager->getPages(2); // as usual: [3, 4, *5*, 6, 7]

foreach ($pager as $item) {
    // iterate on paginated result
}

WDYT?

@docteurklein docteurklein force-pushed the from-result branch 4 times, most recently from fc76fc4 to 8de05d5 Compare November 9, 2016 13:01
…ruction of a pager object via Pager::fromResult

Signed-off-by: Klein Florian <florian.klein@free.fr>
Fabien Schurter and others added 2 commits March 14, 2017 10:34
@beberlei
Copy link
Owner

beberlei commented Jul 2, 2017

@docteurklein It is not backwards compatible, can yo ukeep fromPage as well?

@docteurklein
Copy link
Contributor Author

@beberlei I'm back from vacation :) I'll try to do that and keep you in touch when it's done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants