IcingaHost: add helper methods for Sets, Services
This commit is contained in:
parent
2bf1b3f429
commit
b21ba5dc54
|
@ -421,6 +421,42 @@ class IcingaHost extends IcingaObject
|
|||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IcingaService[]
|
||||
*/
|
||||
public function fetchServices()
|
||||
{
|
||||
$connection = $this->getConnection();
|
||||
$db = $connection->getDbAdapter();
|
||||
|
||||
/** @var IcingaService[] $services */
|
||||
$services = IcingaService::loadAll(
|
||||
$connection,
|
||||
$db->select()->from('icinga_service')
|
||||
->where('host_id = ?', $this->get('id'))
|
||||
);
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IcingaServiceSet[]
|
||||
*/
|
||||
public function fetchServiceSets()
|
||||
{
|
||||
$connection = $this->getConnection();
|
||||
$db = $connection->getDbAdapter();
|
||||
|
||||
/** @var IcingaServiceSet[] $sets */
|
||||
$sets = IcingaServiceSet::loadAll(
|
||||
$connection,
|
||||
$db->select()->from('icinga_service_set')
|
||||
->where('host_id = ?', $this->get('id'))
|
||||
);
|
||||
|
||||
return $sets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue