HostgroupQuery: Join services and servicegroups with a LEFT JOIN

refs #4404
This commit is contained in:
Johannes Meyer 2021-07-05 14:58:49 +02:00
parent 54acf35c69
commit 13125e8059
1 changed files with 5 additions and 5 deletions

View File

@ -225,15 +225,15 @@ class HostgroupQuery extends IdoQuery
protected function joinServicegroups()
{
$this->requireVirtualTable('services');
$this->select->join(
$this->select->joinLeft(
array('sgm' => $this->prefix . 'servicegroup_members'),
'sgm.service_object_id = s.service_object_id',
array()
)->join(
)->joinLeft(
array('sg' => $this->prefix . 'servicegroups'),
'sgm.servicegroup_id = sg.servicegroup_id',
array()
)->join(
)->joinLeft(
array('sgo' => $this->prefix . 'objects'),
'sgo.object_id = sg.servicegroup_object_id AND sgo.is_active = 1 AND sgo.objecttype_id = 4',
array()
@ -246,11 +246,11 @@ class HostgroupQuery extends IdoQuery
protected function joinServices()
{
$this->requireVirtualTable('hosts');
$this->select->join(
$this->select->joinLeft(
array('s' => $this->prefix . 'services'),
's.host_object_id = h.host_object_id',
array()
)->join(
)->joinLeft(
array('so' => $this->prefix . 'objects'),
'so.object_id = s.service_object_id AND so.is_active = 1 AND so.objecttype_id = 2',
array()