public function getIterator()
    {
        //Run the query
        $resp = $this->query->execute();

        //Return the documents as an ArrayIterator to satisfy the requirements
        //of the getIterator function.
        foreach ($resp->data as $document)
        {
            yield $document;
        }

        while ($resp->cursors->next) {
            //send a new request, resetting $resp
            $resp = $this->query->execute($resp->cursors->next);

            foreach ($resp->data as $document)
            {
                yield $document;
            }
        }
    }
public function getIterator()
    {
        //Run the query
        $resp = $this->query->execute();

        //Return the documents as an ArrayIterator to satisfy the requirements
        //of the getIterator function.
        foreach ($resp->data as $document)
        {
            yield $document;
        }

        while ($resp->cursors->next) {
            //send a new request, resetting $resp
            $resp = $this->query->execute($resp->cursors->next);

            foreach ($resp->data as $document)
            {
                yield $document;
            }
        }
    }
public function getIterator ( ) { //Run the query $ resp = $ this -> query -> execute ( ) ; //Return the documents as an ArrayIterator to satisfy the requirements //of the getIterator function. foreach ( $ resp -> data as $ document ) { yield $ document ; } while ( $ resp -> cursors -> next ) { //send a new request, resetting $resp $ resp = $ this -> query -> execute ( $ resp -> cursors -> next ) ; foreach ( $ resp -> data as $ document ) { yield $ document ; } } }
Required function for any class that implements IteratorAggregate.  Will
yield documents as they become available.  If cursors are returned
then subsequent requests will be made, yielding more documents.

@return \Generator
@throws MontageException
Required function for any class that implements IteratorAggregate . Will yield documents as they become available . If cursors are returned then subsequent requests will be made yielding more documents .