StateHistoryQuery: Make whereToSql robust

This fixes bugs is a array for expression comes in or types
does not exist.

fixes #7133
This commit is contained in:
Marius Hein 2014-09-10 10:07:03 +02:00
parent da7e599363
commit 9c2cf0bd0f
1 changed files with 5 additions and 3 deletions

View File

@ -38,8 +38,11 @@ class StatehistoryQuery extends IdoQuery
{
if ($col === 'UNIX_TIMESTAMP(sh.state_time)') {
return 'sh.state_time ' . $sign . ' ' . $this->timestampForSql($this->valueToTimestamp($expression));
} elseif ($col === $this->columnMap['statehistory']['type']) {
return 'sh.state_type ' . $sign . ' ' . $this->types[$expression];
} elseif ($col === $this->columnMap['statehistory']['type']
&& is_array($expression) === false
&& array_key_exists($expression, $this->types) === true
) {
return 'sh.state_type ' . $sign . ' ' . $this->types[$expression];
} else {
return parent::whereToSql($col, $sign, $expression);
}
@ -58,4 +61,3 @@ class StatehistoryQuery extends IdoQuery
$this->joinedVirtualTables = array('statehistory' => true);
}
}