Revert "Fetchable: Add method fetch() which returns an iterator"

This reverts commit 7a6837de0e.
This commit is contained in:
Johannes Meyer 2015-05-18 15:17:22 +02:00
parent be36809552
commit 742dfcaf41
3 changed files with 5 additions and 35 deletions

View File

@ -3,20 +3,11 @@
namespace Icinga\Data; namespace Icinga\Data;
use Iterator;
/** /**
* Interface for retrieving data * Interface for retrieving data
*/ */
interface Fetchable interface Fetchable
{ {
/**
* Fetch and return all rows of the result set using an iterator
*
* @return Iterator
*/
public function fetch();
/** /**
* Retrieve an array containing all rows of the result set * Retrieve an array containing all rows of the result set
* *

View File

@ -4,7 +4,6 @@
namespace Icinga\Data; namespace Icinga\Data;
use ArrayIterator; use ArrayIterator;
use Iterator;
use IteratorAggregate; use IteratorAggregate;
use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\Filter;
use Icinga\Exception\IcingaException; use Icinga\Exception\IcingaException;
@ -104,11 +103,11 @@ class SimpleQuery implements QueryInterface, Queryable, IteratorAggregate
/** /**
* Return a iterable for this query's result * Return a iterable for this query's result
* *
* @return Iterator * @return ArrayIterator
*/ */
public function getIterator() public function getIterator()
{ {
return $this->fetch(); return new ArrayIterator($this->fetchAll());
} }
/** /**
@ -352,16 +351,6 @@ class SimpleQuery implements QueryInterface, Queryable, IteratorAggregate
return $this->limitOffset; return $this->limitOffset;
} }
/**
* Fetch and return all rows of the result set using an iterator
*
* @return ArrayIterator
*/
public function fetch()
{
return new ArrayIterator($this->fetchAll());
}
/** /**
* Retrieve an array containing all rows of the result set * Retrieve an array containing all rows of the result set
* *

View File

@ -3,7 +3,7 @@
namespace Icinga\Module\Monitoring\DataView; namespace Icinga\Module\Monitoring\DataView;
use Iterator; use ArrayIterator;
use IteratorAggregate; use IteratorAggregate;
use Icinga\Data\QueryInterface; use Icinga\Data\QueryInterface;
use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\Filter;
@ -61,11 +61,11 @@ abstract class DataView implements QueryInterface, IteratorAggregate
/** /**
* Return a iterator for all rows of the result set * Return a iterator for all rows of the result set
* *
* @return Iterator * @return ArrayIterator
*/ */
public function getIterator() public function getIterator()
{ {
return $this->fetch(); return new ArrayIterator($this->fetchAll());
} }
/** /**
@ -469,16 +469,6 @@ abstract class DataView implements QueryInterface, IteratorAggregate
return $this->query->hasOffset(); return $this->query->hasOffset();
} }
/**
* Fetch and return all rows of the result set using an iterator
*
* @return Iterator
*/
public function fetch()
{
return $this->getQuery()->fetch();
}
/** /**
* Retrieve an array containing all rows of the result set * Retrieve an array containing all rows of the result set
* *