mirror of
https://github.com/Icinga/icingaweb2.git
synced 2026-05-28 04:02:39 -04:00
DataView: Implement interface IteratorAggregate
I'd like to foreach such.
This commit is contained in:
parent
ed5f646b6f
commit
5faebb4a88
1 changed files with 12 additions and 0 deletions
|
|
@ -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 a new issue