Introduce query InstanceQuery

refs #9945
This commit is contained in:
Johannes Meyer 2015-08-26 10:54:42 +02:00
parent 241f73f229
commit ffcd33ee7e
2 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,26 @@
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
class InstanceQuery extends IdoQuery
{
/**
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_id' => 'i.instance_id',
'instance_name' => 'i.instance_name'
)
);
/**
* {@inheritdoc}
*/
protected function joinBaseTables()
{
$this->select()->from(array('i' => $this->prefix . 'instances'));
$this->joinedVirtualTables['instances'] = true;
}
}

View File

@ -0,0 +1,33 @@
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
namespace Icinga\Module\Monitoring\DataView;
/**
* View representation for instances
*/
class Instance extends DataView
{
/**
* {@inheritdoc}
*/
public function getColumns()
{
return array(
'instance_id',
'instance_name'
);
}
/**
* {@inheritdoc}
*/
public function getSortRules()
{
return array(
'instance_name' => array(
'order' => self::SORT_ASC
)
);
}
}