parent
27f4fe82cd
commit
bdb73ec06e
|
@ -33,6 +33,11 @@ class HoststatehistoryQuery extends IdoQuery
|
|||
'hard_state' => 1
|
||||
);
|
||||
|
||||
protected $subQueryTargets = array(
|
||||
'hostgroups' => 'hostgroup',
|
||||
'servicegroups' => 'servicegroup'
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -186,4 +191,19 @@ class HoststatehistoryQuery extends IdoQuery
|
|||
array()
|
||||
);
|
||||
}
|
||||
|
||||
protected function joinSubQuery(IdoQuery $query, $name)
|
||||
{
|
||||
if ($name === 'hostgroup') {
|
||||
$query->joinVirtualTable('members');
|
||||
|
||||
return ['hgm.host_object_id', 'ho.object_id'];
|
||||
} elseif ($name === 'servicegroup') {
|
||||
$query->joinVirtualTable('services');
|
||||
|
||||
return ['s.host_object_id', 'ho.object_id'];
|
||||
}
|
||||
|
||||
return parent::joinSubQuery($query, $name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue