Added a few columns to Ido\ContactgroupQuery, fixed joins

This commit is contained in:
Thomas Gelf 2013-08-20 23:06:32 +02:00 committed by Eric Lippmann
parent 23235e4513
commit 521ef8cc47
1 changed files with 28 additions and 5 deletions

View File

@ -10,13 +10,32 @@ class ContactgroupQuery extends AbstractQuery
'contactgroup_alias' => 'cg.alias',
),
'contacts' => array(
'contact_name' => 'co.name1 COLLATE latin1_general_ci',
'contact_name' => 'co.name1 COLLATE latin1_general_ci',
'contact_alias' => 'c.alias',
'contact_email' => 'c.email_address',
'contact_pager' => 'c.pager_address',
'contact_has_host_notfications' => 'c.host_notifications_enabled',
'contact_has_service_notfications' => 'c.service_notifications_enabled',
'contact_can_submit_commands' => 'c.can_submit_commands',
'contact_notify_service_recovery' => 'c.notify_service_recovery',
'contact_notify_service_warning' => 'c.notify_service_warning',
'contact_notify_service_critical' => 'c.notify_service_critical',
'contact_notify_service_unknown' => 'c.notify_service_unknown',
'contact_notify_service_flapping' => 'c.notify_service_flapping',
'contact_notify_service_downtime' => 'c.notify_service_recovery',
'contact_notify_host_recovery' => 'c.notify_host_recovery',
'contact_notify_host_down' => 'c.notify_host_down',
'contact_notify_host_unreachable' => 'c.notify_host_unreachable',
'contact_notify_host_flapping' => 'c.notify_host_flapping',
'contact_notify_host_downtime' => 'c.notify_host_downtime',
),
'hosts' => array(
'host_name' => 'ho.name1',
'host_object_id' => 'ho.object_id',
'host_name' => 'ho.name1',
),
'services' => array(
'service_host_name' => 'so.name1 COLLATE latin1_general_ci',
'service_object_id' => 'so.object_id',
'service_host_name' => 'so.name1 COLLATE latin1_general_ci',
'service_description' => 'so.name2 COLLATE latin1_general_ci',
)
);
@ -38,7 +57,7 @@ class ContactgroupQuery extends AbstractQuery
protected function joinContacts()
{
$this->baseQuery->join(
$this->baseQuery->distinct()->join(
array('cgm' => $this->prefix . 'contactgroup_members'),
'cgm.contactgroup_id = cg.contactgroup_id',
array()
@ -46,12 +65,16 @@ class ContactgroupQuery extends AbstractQuery
array('co' => $this->prefix . 'objects'),
'cgm.contact_object_id = co.object_id AND co.is_active = 1',
array()
)->join(
array('c' => $this->prefix . 'contacts'),
'c.contact_object_id = co.object_id',
array()
);
}
protected function joinHosts()
{
$this->baseQuery->join(
$this->baseQuery->distinct()->join(
array('hcg' => $this->prefix . 'host_contactgroups'),
'hcg.contactgroup_object_id = cg.contactgroup_object_id',
array()