Use subquery filters for service state history if appropriate
refs #2934
This commit is contained in:
parent
bdb73ec06e
commit
81b6b0129b
|
@ -33,6 +33,11 @@ class ServicestatehistoryQuery extends IdoQuery
|
|||
'hard_state' => 1
|
||||
);
|
||||
|
||||
protected $subQueryTargets = array(
|
||||
'hostgroups' => 'hostgroup',
|
||||
'servicegroups' => 'servicegroup'
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -184,4 +189,19 @@ class ServicestatehistoryQuery extends IdoQuery
|
|||
array()
|
||||
);
|
||||
}
|
||||
|
||||
protected function joinSubQuery(IdoQuery $query, $name)
|
||||
{
|
||||
if ($name === 'hostgroup') {
|
||||
$query->joinVirtualTable('services');
|
||||
|
||||
return ['so.object_id', 'so.object_id'];
|
||||
} elseif ($name === 'servicegroup') {
|
||||
$query->joinVirtualTable('members');
|
||||
|
||||
return ['sgm.service_object_id', 'so.object_id'];
|
||||
}
|
||||
|
||||
return parent::joinSubQuery($query, $name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue