mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-22 13:24:24 +02:00
SimpleQuery: Implement interface IteratorAggregate
I'd like to foreach such.
This commit is contained in:
parent
3770741ba5
commit
ed5f646b6f
@ -4,13 +4,15 @@
|
|||||||
namespace Icinga\Data;
|
namespace Icinga\Data;
|
||||||
|
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
|
use ArrayIterator;
|
||||||
|
use IteratorAggregate;
|
||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
||||||
use Zend_Paginator;
|
use Zend_Paginator;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
|
|
||||||
class SimpleQuery implements QueryInterface, Queryable
|
class SimpleQuery implements QueryInterface, Queryable, IteratorAggregate
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Query data source
|
* Query data source
|
||||||
@ -91,6 +93,16 @@ class SimpleQuery implements QueryInterface, Queryable
|
|||||||
*/
|
*/
|
||||||
protected function init() {}
|
protected function init() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a iterable for this query's result
|
||||||
|
*
|
||||||
|
* @return ArrayIterator
|
||||||
|
*/
|
||||||
|
public function getIterator()
|
||||||
|
{
|
||||||
|
return new ArrayIterator($this->fetchAll());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data source
|
* Get the data source
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user