Iterate over the query results.

@return \Iterator
439027
public function getIterator(): \Iterator
    {
        $hydrator = $this->documentManager->newHydrator($this->hydrationMode);
        $query = clone $this->query;

        if (! $query->hasParam('_source')) {
            /** @var DocumentMetadata $class */
            $class = $this->documentManager->getClassMetadata($this->documentClass);
            $query->setSource($class->eagerFieldNames);
        }

        if (null !== $this->sort) {
            $query->setSort($this->sort);
        }

        if (null !== $this->limit) {
            $query->setSize($this->limit);
        }

        if (null !== $this->offset) {
            $query->setFrom($this->offset);
        }

        $generator = null !== $this->cacheProfile ? $this->_doExecuteCached($query) : $this->_doExecute($query);
        foreach ($generator as $resultSet) {
            yield from $hydrator->hydrateAll($resultSet, $this->documentClass);
        }
    }
833930
public function getNbResults()
    {
        if (isset($this->nbResults)) {
            return $this->nbResults;
        }

        $countQuery = clone $this->query;
        $countQuery->limit = 0;

        return $this->nbResults = $this->searchService->findLocations($countQuery)->totalCount;
    }
342642
public function results()
    {

        if ($this->classname) {
            $orderAdapter = app(\Antares\Datatables\Adapter\OrderAdapter::class);
            $orderAdapter->setClassname($this->classname);
            $orderAdapter->setEngineInstance($this);

            $groupsFilterAdapter = app(\Antares\Datatables\Adapter\GroupsFilterAdapter::class);
            $groupsFilterAdapter->setClassname($this->classname);
            $groupsFilterAdapter->setEngineInstance($this);
        }
        return $this->query->get();
    }
193431
public function getNbResults()
    {
        if (isset($this->nbResults)) {
            return $this->nbResults;
        }

        $countQuery = clone $this->query;
        $countQuery->limit = 0;

        return $this->nbResults = $this->findService->findNodes($countQuery)->totalCount;
    }
595656
public function getNbResults()
    {
        if (isset($this->nbResults)) {
            return $this->nbResults;
        }

        $countQuery = clone $this->query;
        $countQuery->limit = 0;

        return $this->nbResults = $this->trashService->findTrashItems($countQuery)->count;
    }
1121990
public function getIterator() : iterable
    {
        foreach ($this->bufferedChanges as $change) {
            yield $change;
        }

        foreach ($this->unBufferedChanges ?? [] as $change) {
            $this->bufferedChanges[] = $change;

            yield $change;
        }

        $this->unBufferedChanges = null;
    }
33930
public function getResults()
	{
		if (!isset($this->resultset))
		{
			$this->run();
		}

		$documents = array();
		foreach ($this->resultset as $document)
		{
			array_push($documents, $document);
		}

		foreach ($documents as &$document)
		{
			$document = $document->getFields();
		}

		return $documents;
	}
314121
public Iterator<QueryParameters> iterator() {
        final QueryParametersLazyList source = this;

        return new Iterator<QueryParameters>() {
            private LazyCacheIterator<QueryParameters> lazyCacheIterator = source.getLazyCacheIterator(-1);

            public boolean hasNext() {
                return lazyCacheIterator.hasNext();
            }

            public QueryParameters next() {
                return lazyCacheIterator.getNext();
            }

            public void remove() {
                source.remove(currentIndex);
            }
        };
    }
428949
public function getIterator()
    {
        if ($this->offset > 0) {
            $key   = null;
            $index = 0;
            //Skip the first N
            while (false !== ($record = $this->statement->fetch())) {
                if ($key === $record[ $this->pkField ]) {
                    continue;
                }
                $key = $record[ $this->pkField ];
                if ($index++ === $this->offset) {
                    break;
                }
            }
            $current = $record;
        } else {
            $current = $this->statement->fetch();
        }

        $currentKey = $current[ $this->pkField ];

        $fetchedRecordCount = 1;
        do {
            yield $currentKey => $current;

            $current = $this->statement->fetch();
            if (empty($current)) {
                break;
            }
            if ($currentKey !== $current[ $this->pkField ]) {
                $currentKey = $current[ $this->pkField ];
                $fetchedRecordCount++;
            }
        } while ($fetchedRecordCount <= $this->limit);

        $this->statement->closeCursor();
    }
655854
protected function loop() {
		$data = [];
		$meta = [];

		$this->args = apply_filters( Collection\Filter::COLLECTION_ARGS, $this->args );
		$this->query = new \WP_Query( $this->args );
		while ( $this->query->have_posts() ) {
			$this->query->the_post();
			$data[] = $this->format_item( $this->query->post );

			if ( empty( $meta ) ) {
				// Take the metadata from the first post.
				$meta = \Lean\Utils\Meta\Collection::get_all_collection_meta( $this->query->post );
			}
		}

		wp_reset_postdata();

		$response = [
			'data' => $data,
			'meta' => $meta,
			'pagination' => $this->get_pagination(
				$this->query->found_posts,
				$this->query->max_num_pages
			),
		];

		return apply_filters( Collection\Filter::COLLECTION_DATA, $response, $this->args );
	}
1258025
protected function getQueryResult()
    {
        if ($this->queryResult) {
            return $this->queryResult;
        }

        return $this->queryResult = $this->getSelector()
            ->getSelectBuilder()
            ->execute();
    }
528173
protected function _getIterator()
    {
        if (is_null($this->iterator)) {
            $this->iterator = $this->_resolveIterator($this->_getDataStore());
        }

        return $this->iterator;
    }
281172
public function getIterator()
    {

        if ($this->iteratorCache) {
            return $this->iteratorCache;
        }

        $this->parseInputOnce();

        $this->iteratorCache = $this->createTraversable($this->filters, $this->sorting(), $this->queryKeys());

        return $this->iteratorCache;
    }
1220931
public function getIterator(){
		if(!isset($this->iterator))
			$this->iterator = new ResultIterator($this);
		return $this->iterator;
	}
11612
private function query()
    {
        foreach ($this->search_models as $model_name => $filters) {
            // Apply search against the original model.
            if ($model_name === 'self') {
                self::applySearch($this->query, $filters);
                continue;
            }

            // Apply search against the related model.
            $this->query->whereHas($model_name, function ($query) use ($filters) {
                self::applySearch($query, $filters);
            });
        }

        return $this->query;
    }
678496
public function getIterator() {
        $ret = array('id' => $this->record->id);
        foreach ($this->record as $property => $value) {
            $ret[$property] = $value;
        }
        return new ArrayIterator($ret);
    }
236663
public function getIterator(): Iterator
    {
        $map = $this->map;
        foreach ($map as $ordinal => $value) {
            yield ($this->enumeration)::byOrdinal($ordinal) => $value;
        }
    }