parent
f7f02bdc8f
commit
271a1d72f1
|
@ -23,6 +23,11 @@ class ContactgroupQuery extends IdoQuery
|
|||
*/
|
||||
protected $groupOrigin = array('hosts', 'members', 'services');
|
||||
|
||||
protected $subQueryTargets = array(
|
||||
'hostgroups' => 'hostgroup',
|
||||
'servicegroups' => 'servicegroup'
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -187,4 +192,23 @@ class ContactgroupQuery extends IdoQuery
|
|||
array()
|
||||
);
|
||||
}
|
||||
|
||||
protected function joinSubQuery(IdoQuery $query, $name)
|
||||
{
|
||||
if ($name === 'hostgroup') {
|
||||
$this->requireVirtualTable('hosts');
|
||||
|
||||
$query->joinVirtualTable('members');
|
||||
|
||||
return ['hgm.host_object_id', 'ho.object_id'];
|
||||
} elseif ($name === 'servicegroup') {
|
||||
$this->requireVirtualTable('services');
|
||||
|
||||
$query->joinVirtualTable('members');
|
||||
|
||||
return ['sgm.service_object_id', 'so.object_id'];
|
||||
}
|
||||
|
||||
return parent::joinSubQuery($query, $name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue