monitoring: Rearrange code in the ContactQuery

refs #9956
This commit is contained in:
Eric Lippmann 2015-09-29 22:20:39 +02:00
parent e110649184
commit 02215592be
1 changed files with 22 additions and 22 deletions

View File

@ -97,23 +97,6 @@ class ContactQuery extends IdoQuery
$this->joinedVirtualTables['contacts'] = true; $this->joinedVirtualTables['contacts'] = true;
} }
/**
* Join timeperiods
*/
protected function joinTimeperiods()
{
$this->select->joinLeft(
array('ht' => $this->prefix . 'timeperiods'),
'ht.timeperiod_object_id = c.host_timeperiod_object_id',
array()
);
$this->select->joinLeft(
array('st' => $this->prefix . 'timeperiods'),
'st.timeperiod_object_id = c.service_timeperiod_object_id',
array()
);
}
/** /**
* Join host groups * Join host groups
*/ */
@ -155,6 +138,18 @@ class ContactQuery extends IdoQuery
); );
} }
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = c.instance_id',
array()
);
}
/** /**
* Join service groups * Join service groups
*/ */
@ -197,13 +192,18 @@ class ContactQuery extends IdoQuery
} }
/** /**
* Join instances * Join time periods
*/ */
protected function joinInstances() protected function joinTimeperiods()
{ {
$this->select->join( $this->select->joinLeft(
array('i' => $this->prefix . 'instances'), array('ht' => $this->prefix . 'timeperiods'),
'i.instance_id = c.instance_id', 'ht.timeperiod_object_id = c.host_timeperiod_object_id',
array()
);
$this->select->joinLeft(
array('st' => $this->prefix . 'timeperiods'),
'st.timeperiod_object_id = c.service_timeperiod_object_id',
array() array()
); );
} }