5 class Rowset
implements \IteratorAggregate
8 * @var \pq\Gateway\Table
18 * @param \pq\Gateway\Table $table
19 * @param \pq\Result $result
21 function __construct(Table
$table, \pq\Result
$result, $rowClass = "\\pq\\Gateway\\Row") {
22 $this->table
= $table;
23 while (($row = $result->fetchRow(\pq\Result
::FETCH_ASSOC
))) {
24 $this->rows
[] = new $rowClass($this->table
, $row);
29 * @implements \IteratorAggregate
30 * @return \pq\Gateway\ArrayIterator
32 function getIterator() {
33 return new \
ArrayIterator($this->rows
);
39 * @return \pq\Gateway\Rowset
41 function filter(callable
$cb) {
42 $rowset = clone $this;
43 $rowset->rows
= array_filter($this->rows
, $cb);