NotificationQuery: Add query column `instance_name'

refs #9943
This commit is contained in:
Johannes Meyer 2015-08-25 16:35:16 +02:00
parent 5c2fd63347
commit 780ac16be1
4 changed files with 33 additions and 1 deletions

View File

@ -17,6 +17,9 @@ class HostnotificationQuery extends IdoQuery
* {@inheritdoc} * {@inheritdoc}
*/ */
protected $columnMap = array( protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'notifications' => array( 'notifications' => array(
'notification_output' => 'hn.output', 'notification_output' => 'hn.output',
'notification_start_time' => 'UNIX_TIMESTAMP(hn.start_time)', 'notification_start_time' => 'UNIX_TIMESTAMP(hn.start_time)',
@ -224,6 +227,18 @@ class HostnotificationQuery extends IdoQuery
); );
} }
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = hn.instance_id',
array()
);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -26,7 +26,8 @@ class NotificationQuery extends IdoQuery
'acknowledgement_entry_time' => 'n.acknowledgement_entry_time', 'acknowledgement_entry_time' => 'n.acknowledgement_entry_time',
'acknowledgement_author_name' => 'n.acknowledgement_author_name', 'acknowledgement_author_name' => 'n.acknowledgement_author_name',
'acknowledgement_comment_data' => 'n.acknowledgement_comment_data', 'acknowledgement_comment_data' => 'n.acknowledgement_comment_data',
'object_type' => 'n.object_type' 'object_type' => 'n.object_type',
'instance_name' => 'n.instance_name'
), ),
'history' => array( 'history' => array(
'type' => 'n.type', 'type' => 'n.type',

View File

@ -17,6 +17,9 @@ class ServicenotificationQuery extends IdoQuery
* {@inheritdoc} * {@inheritdoc}
*/ */
protected $columnMap = array( protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'notifications' => array( 'notifications' => array(
'notification_output' => 'sn.output', 'notification_output' => 'sn.output',
'notification_start_time' => 'UNIX_TIMESTAMP(sn.start_time)', 'notification_start_time' => 'UNIX_TIMESTAMP(sn.start_time)',
@ -222,6 +225,18 @@ class ServicenotificationQuery extends IdoQuery
); );
} }
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = sn.instance_id',
array()
);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -11,6 +11,7 @@ class Notification extends DataView
public function getColumns() public function getColumns()
{ {
return array( return array(
'instance_name',
'notification_state', 'notification_state',
'notification_start_time', 'notification_start_time',
'notification_contact_name', 'notification_contact_name',