IcingaHost: add helper methods for Sets, Services

This commit is contained in:
Thomas Gelf 2017-08-18 16:42:56 +02:00
parent 2bf1b3f429
commit b21ba5dc54
1 changed files with 36 additions and 0 deletions

View File

@ -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
*/