From 5d50eabb4410ceea0ba9170bbfe3e5fb5004ffe5 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 2 Jun 2015 10:39:49 +0200 Subject: [PATCH] FileReader: Mimic cursor capability --- library/Icinga/Protocol/File/FileReader.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/library/Icinga/Protocol/File/FileReader.php b/library/Icinga/Protocol/File/FileReader.php index 2c43d390a..d9c984ca8 100644 --- a/library/Icinga/Protocol/File/FileReader.php +++ b/library/Icinga/Protocol/File/FileReader.php @@ -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. *