monitoring: Add `DataView::count()'
This commit is contained in:
parent
264d818133
commit
2dd81d12ba
|
@ -4,6 +4,7 @@
|
|||
|
||||
namespace Icinga\Module\Monitoring\DataView;
|
||||
|
||||
use Countable;
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Data\SimpleQuery;
|
||||
use Icinga\Data\Browsable;
|
||||
|
@ -18,7 +19,7 @@ use Icinga\Module\Monitoring\Backend;
|
|||
/**
|
||||
* A read-only view of an underlying query
|
||||
*/
|
||||
abstract class DataView implements Browsable, Filterable, Sortable
|
||||
abstract class DataView implements Browsable, Countable, Filterable, Sortable
|
||||
{
|
||||
/**
|
||||
* The query used to populate the view
|
||||
|
@ -26,7 +27,7 @@ abstract class DataView implements Browsable, Filterable, Sortable
|
|||
* @var SimpleQuery
|
||||
*/
|
||||
private $query;
|
||||
|
||||
|
||||
protected $filter;
|
||||
|
||||
protected $connection;
|
||||
|
@ -328,4 +329,14 @@ public function dump()
|
|||
{
|
||||
return $this->query->paginate($itemsPerPage, $pageNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count result set
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->query);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue