diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php index e73baa1b6..afb4640f0 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php @@ -23,6 +23,11 @@ class ServicedowntimestarthistoryQuery extends IdoQuery */ protected $groupOrigin = array('hostgroups', 'servicegroups'); + protected $subQueryTargets = array( + 'hostgroups' => 'hostgroup', + 'servicegroups' => 'servicegroup' + ); + /** * {@inheritdoc} */ @@ -178,4 +183,19 @@ class ServicedowntimestarthistoryQuery 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); + } }