NotificationQuery: Fix PostgreSQL icompatibility

refs #4187
This commit is contained in:
Eric Lippmann 2013-08-16 16:18:20 +02:00
parent f4b8b369a8
commit e5f3a063fb
1 changed files with 34 additions and 26 deletions

View File

@ -25,9 +25,8 @@
namespace Monitoring\Backend\Ido\Query;
/**
* NotificationQuery
* Notification query
*/
class NotificationQuery extends AbstractQuery
{
@ -60,9 +59,12 @@ class NotificationQuery extends AbstractQuery
*/
protected function joinBaseTables()
{
$this->baseQuery = $this->db->select()->from(array(
$this->baseQuery = $this->db->select()->from(
array(
'n' => $this->prefix . 'notifications'
));
),
array()
);
$this->joinedVirtualTables = array('notification' => true);
}
@ -71,11 +73,12 @@ class NotificationQuery extends AbstractQuery
*/
protected function joinObjects()
{
$this->baseQuery->joinInner(
$this->baseQuery->join(
array(
'o' => $this->prefix . 'objects'
),
'n.object_id = o.object_id AND o.is_active = 1 AND o.objecttype_id IN (1, 2)'
'n.object_id = o.object_id AND o.is_active = 1 AND o.objecttype_id IN (1, 2)',
array()
);
}
@ -84,17 +87,19 @@ class NotificationQuery extends AbstractQuery
*/
protected function joinContact()
{
$this->baseQuery->joinInner(
$this->baseQuery->join(
array(
'c' => $this->prefix . 'contactnotifications'
),
'n.notification_id = c.notification_id'
'n.notification_id = c.notification_id',
array()
);
$this->baseQuery->joinInner(
$this->baseQuery->join(
array(
'c_o' => $this->prefix . 'objects'
),
'c.contact_object_id = c_o.object_id'
'c.contact_object_id = c_o.object_id',
array()
);
}
@ -103,23 +108,26 @@ class NotificationQuery extends AbstractQuery
*/
protected function joinCommand()
{
$this->baseQuery->joinInner(
$this->baseQuery->join(
array(
'cmd_c' => $this->prefix . 'contactnotifications'
),
'n.notification_id = cmd_c.notification_id'
'n.notification_id = cmd_c.notification_id',
array()
);
$this->baseQuery->joinInner(
$this->baseQuery->join(
array(
'cmd_m' => $this->prefix . 'contactnotificationmethods'
),
'cmd_c.notification_id = cmd_m.contactnotification_id'
'cmd_c.notification_id = cmd_m.contactnotification_id',
array()
);
$this->baseQuery->joinInner(
$this->baseQuery->join(
array(
'cmd_o' => $this->prefix . 'objects'
),
'cmd_m.command_object_id = cmd_o.object_id'
'cmd_m.command_object_id = cmd_o.object_id',
array()
);
}
}