Closed Naoray closed 11 months ago
Nice!
Named arguments would require PHP 8.0 though, right? It's just the example you used here, but still worth noting.
Additionally, having those examples in the examples/
directory would be nice IMHO.
Nice!
Named arguments would require PHP 8.0 though, right? It's just the example you used here, but still worth noting.
Additionally, having those examples in the
examples/
directory would be nice IMHO.
@fjbender yes the named arguments is just an example. You could also use the functionality like
foreach ($client->orders->iterator(null, null, [], true) as $order) {
echo($order->id);
}
—
I’ve added the code to the examples.
This PR adds new
iterator
methods which returnGenerator
s in order to simply loop over all results from provided by the Mollie API. It takes a similar approach as the basic implementation of the iteration API on the Mollie NodeJS repo.Essentially all endpoints that extend the
CollectionEndpointAbstract
and provide a Collection that extendsCursorCollection
(all that support cursor pagination) have been giveniterator()
methods (or variations of it). Theiterator()
methods take the same params as thepage()
method (or variations of the page method).Here is an overview of how the iteration methods map to previous existing page like methods:
page()
->iterator()
listFor()
->iteratorFor()
listForId()
->iteratorForId()
Basic Usage
Backwards looping