Thomas Gelf 4680fa5447 SimpleQueryBasedTable: add new table type...
...and move logic common with ZfQueryBasedTable to a new base class
2017-08-12 12:02:36 +02:00

35 lines
654 B
PHP

<?php
namespace ipl\Web\Table;
use Icinga\Data\SimpleQuery;
use ipl\Data\SimpleQueryPaginationAdapter;
abstract class SimpleQueryBasedTable extends QueryBasedTable
{
/** @var SimpleQuery */
private $query;
protected function getPaginationAdapter()
{
return new SimpleQueryPaginationAdapter($this->getQuery());
}
protected function fetchQueryRows()
{
return $this->query->fetchAll();
}
/**
* @return SimpleQuery
*/
public function getQuery()
{
if ($this->query === null) {
$this->query = $this->prepareQuery();
}
return $this->query;
}
}