HostcommentQuery: PostgreSQL grouping...

refs #9009
This commit is contained in:
Johannes Meyer 2015-06-18 11:17:14 +02:00
parent 4f42da49a8
commit 99b0d63e94
1 changed files with 20 additions and 2 deletions

View File

@ -88,7 +88,6 @@ class HostcommentQuery extends IdoQuery
'hgo.object_id = hg.hostgroup_object_id AND hgo.is_active = 1 AND hgo.objecttype_id = 3',
array()
);
$this->group(array('c.comment_id', 'ho.name1'));
}
/**
@ -150,6 +149,25 @@ class HostcommentQuery extends IdoQuery
'so.object_id = s.service_object_id AND so.is_active = 1 AND so.objecttype_id = 2',
array()
);
$this->group(array('c.comment_id', 'ho.name1'));
}
/**
* {@inheritdoc}
*/
public function getGroup()
{
$group = array();
if ($this->hasJoinedVirtualTable('hostgroups') || $this->hasJoinedVirtualTable('servicegroups')) {
$group = array('c.comment_id', 'ho.object_id');
if ($this->hasJoinedVirtualTable('hosts')) {
$group[] = 'h.host_id';
}
if ($this->hasJoinedVirtualTable('hoststatus')) {
$group[] = 'hs.hoststatus_id';
}
}
return $group;
}
}