Skip to content

Add support for cursor based pagination (again) #136

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

Merged
merged 3 commits into from
Feb 16, 2020

Conversation

rjacobso
Copy link
Contributor

@rjacobso rjacobso commented Feb 7, 2020

This is an attempt to implement the same logic from #125 but without breaking backwards-compat.

@tareqtms tareqtms merged commit c0fe795 into phpclassic:master Feb 16, 2020
@hippoduck
Copy link

What is the correct way to use this to get all products? I used your example code on your other PR, but I get the following error:

No action named lastResourceContainsNextPageInfo is defined for Product in ....

@rjacobso
Copy link
Contributor Author

rjacobso commented Mar 5, 2020

You are correct, it seems there was another competing pull request to do this in a different manner. It looks like @tareqtms approved both, but some / most of my changes were removed as part of the merge. - Actually this could have been me screwing it up trying to bring my repo up to date. Looking now ...

@tareqtms
Copy link
Contributor

tareqtms commented Mar 5, 2020

The working code should be here:

$productResource =  $shopify->Product();
$products = $productResource->get(['limit'=>50]);
$nextPageProducts = $productResource->get($productResource->getNextPageParams());
/* in short: you need to reuse the resource to get the params before making another resource */**

Please follow the thread #101 for more info.

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.

3 participants