Ido\EventHistoryQuery: fix it to fit new filters

Works for single objects, still some work required for "generic"
history.
This commit is contained in:
Thomas Gelf 2014-06-17 14:02:54 +00:00
parent 21febddad2
commit 8185f8b8a9
1 changed files with 20 additions and 2 deletions

View File

@ -55,14 +55,14 @@ class EventHistoryQuery extends IdoQuery
$this->createSubQuery('Downtimestarthistory', $columns), $this->createSubQuery('Downtimestarthistory', $columns),
$this->createSubQuery('Downtimeendhistory', $columns), $this->createSubQuery('Downtimeendhistory', $columns),
$this->createSubQuery('Commenthistory', $columns), $this->createSubQuery('Commenthistory', $columns),
$this->createSubQuery('Commentdeletionhistory', $columns),
$this->createSubQuery('Notificationhistory', $columns) $this->createSubQuery('Notificationhistory', $columns)
); );
$sub = $this->db->select()->union($this->subQueries, Zend_Db_Select::SQL_UNION_ALL); $sub = $this->db->select()->union($this->subQueries, Zend_Db_Select::SQL_UNION_ALL);
$this->select->from( $this->select->from(
array('eho' => $this->prefix . 'objects'), array('eho' => $this->prefix . 'objects'),
array() '*'
)->join( )->join(
array('eh' => $sub), array('eh' => $sub),
'eho.' . $this->object_id . ' = eh.' . $this->object_id . ' AND eho.is_active = 1', 'eho.' . $this->object_id . ' = eh.' . $this->object_id . ' AND eho.is_active = 1',
@ -71,6 +71,24 @@ class EventHistoryQuery extends IdoQuery
$this->joinedVirtualTables = array('eventhistory' => true); $this->joinedVirtualTables = array('eventhistory' => true);
} }
public function order($columnOrAlias, $dir = null)
{
foreach ($this->subQueries as $sub) {
$sub->requireColumn($columnOrAlias);
}
return parent::order($columnOrAlias, $dir);
}
public function where($condition, $value = null)
{
$this->requireColumn($condition);
foreach ($this->subQueries as $sub) {
$sub->where($condition, $value);
}
return $this;
}
protected function joinHostgroups() protected function joinHostgroups()
{ {
$this->select->join( $this->select->join(