RepositoryQuery: Do not bypass the query's own iterator

refs #9661
This commit is contained in:
Johannes Meyer 2015-07-31 13:12:41 +02:00
parent c5b5d3c9c3
commit fe41d312ca
1 changed files with 7 additions and 1 deletions

View File

@ -5,6 +5,7 @@ namespace Icinga\Repository;
use Iterator;
use IteratorAggregate;
use Traversable;
use Icinga\Application\Benchmark;
use Icinga\Application\Logger;
use Icinga\Data\QueryInterface;
@ -581,7 +582,12 @@ class RepositoryQuery implements QueryInterface, SortRules, Iterator
$this->order();
}
$iterator = $this->repository->getDataSource()->query($this->query);
if ($this->query instanceof Traversable) {
$iterator = $this->query;
} else {
$iterator = $this->repository->getDataSource()->query($this->query);
}
if ($iterator instanceof IteratorAggregate) {
$this->iterator = $iterator->getIterator();
} else {