Skip to content

Instantly share code, notes, and snippets.

@hannesvdvreken
Created September 5, 2016 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hannesvdvreken/1e13cb769d85be95f43bf2f745d5b9c6 to your computer and use it in GitHub Desktop.
Save hannesvdvreken/1e13cb769d85be95f43bf2f745d5b9c6 to your computer and use it in GitHub Desktop.
functions.php
public function getProperties()
{
$page = 0;
$perPage = 30;
do {
++$page;
$this->propertiesToBeGeneratedQuery->paginate($page, $perPage);
$results = $this->propertiesToBeGeneratedQuery->run();
foreach ($results->getResults() as $property) {
yield $property;
}
} while (($perPage * $page) < $results->getTotal());
}
public function doGuzzleRequests()
{
foreach ($this->getProperties() as $property) {
// $this->client->get(...);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment