DataView: Implement interface IteratorAggregate
I'd like to foreach such.
This commit is contained in:
parent
ed5f646b6f
commit
5faebb4a88
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue