Closed barryvdh closed 5 years ago
This works like this, right?
foreach ($client->getResultsGenerator('product') as $product) {
echo $product['idproduct'] . PHP_EOL;
}
Then I will add this to the documentation.
Yes, it only returns the product itself in the for each (no status or data object)
I have merged this and cleaned the code up a bit. Thanks @barryvdh
By using
yield
, we can use the results directly, before waiting for the batch to finish. This helps reduce memory usage and reduces the rate of the request. Eg. load 100 results, process 1 by 1, load another 100 requests, process those etc.It can still just be used in a foreach, without doing anything different.