MonitoredObject: Allow to fetch servicegroups for host objects

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-23 13:02:43 +02:00
parent 9042d55dd4
commit e42548fc80
1 changed files with 8 additions and 5 deletions

View File

@ -565,12 +565,15 @@ abstract class MonitoredObject implements Filterable
*/
public function fetchServicegroups()
{
$this->servicegroups = $this->backend->select()
$query = $this->backend->select()
->from('servicegroup', array('servicegroup_name', 'servicegroup_alias'))
->where('host_name', $this->host_name)
->where('service_description', $this->service_description)
->applyFilter($this->getFilter())
->fetchPairs();
->where('host_name', $this->host_name);
if ($this->type === self::TYPE_SERVICE) {
$query->where('service_description', $this->service_description);
}
$this->servicegroups = $query->applyFilter($this->getFilter())->fetchPairs();
return $this;
}