Do not join icinga_hosts when fetching a service's contact groups

refs #8614
This commit is contained in:
Eric Lippmann 2015-03-06 10:02:20 +01:00
parent 2b91ec7f2c
commit 64d1d12c73
1 changed files with 4 additions and 2 deletions

View File

@ -426,10 +426,12 @@ abstract class MonitoredObject implements Filterable
$contactsGroups = $this->backend->select()->from('contactgroup', array( $contactsGroups = $this->backend->select()->from('contactgroup', array(
'contactgroup_name', 'contactgroup_name',
'contactgroup_alias' 'contactgroup_alias'
)) ));
->where('host_name', $this->host_name);
if ($this->type === self::TYPE_SERVICE) { if ($this->type === self::TYPE_SERVICE) {
$contactsGroups->where('service_host_name', $this->host_name);
$contactsGroups->where('service_description', $this->service_description); $contactsGroups->where('service_description', $this->service_description);
} else {
$contactsGroups->where('host_name', $this->host_name);
} }
$this->contactgroups = $contactsGroups->getQuery()->fetchAll(); $this->contactgroups = $contactsGroups->getQuery()->fetchAll();
return $this; return $this;