FileReader: Mimic cursor capability

This commit is contained in:
Johannes Meyer 2015-06-02 10:39:49 +02:00
parent ae30a62055
commit 5d50eabb44
1 changed files with 13 additions and 0 deletions

View File

@ -4,6 +4,7 @@
namespace Icinga\Protocol\File;
use Countable;
use ArrayIterator;
use Icinga\Data\Selectable;
use Icinga\Data\ConfigObject;
@ -71,6 +72,18 @@ class FileReader implements Selectable, Countable
return new FileQuery($this);
}
/**
* Fetch and return all rows of the given query's result set using an iterator
*
* @param FileQuery $query
*
* @return ArrayIterator
*/
public function query(FileQuery $query)
{
return new ArrayIterator($this->fetchAll($query));
}
/**
* Return the number of available valid lines.
*