DataView: Implement interface IteratorAggregate

I'd like to foreach such.
This commit is contained in:
Johannes Meyer 2015-05-15 14:26:32 +02:00
parent ed5f646b6f
commit 5faebb4a88
1 changed files with 12 additions and 0 deletions

View File

@ -3,6 +3,8 @@
namespace Icinga\Module\Monitoring\DataView;
use ArrayIterator;
use IteratorAggregate;
use Icinga\Data\QueryInterface;
use Icinga\Data\Filter\Filter;
use Icinga\Data\Filter\FilterMatch;
@ -56,6 +58,16 @@ abstract class DataView implements QueryInterface, IteratorAggregate
{
}
/**
* Return a iterator for all rows of the result set
*
* @return ArrayIterator
*/
public function getIterator()
{
return new ArrayIterator($this->fetchAll());
}
/**
* Get the query name this data view relies on
*