DbRepository: Handle columns of type Zend_Db_Expr

This commit is contained in:
Johannes Meyer 2015-12-04 08:22:48 +01:00
parent e7399c312f
commit 0d1d3c3b8f
1 changed files with 9 additions and 0 deletions

View File

@ -3,6 +3,7 @@
namespace Icinga\Repository; namespace Icinga\Repository;
use Zend_Db_Expr;
use Icinga\Data\Db\DbConnection; use Icinga\Data\Db\DbConnection;
use Icinga\Data\Extensible; use Icinga\Data\Extensible;
use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\Filter;
@ -631,6 +632,10 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
*/ */
public function requireQueryColumn($table, $name, RepositoryQuery $query = null) public function requireQueryColumn($table, $name, RepositoryQuery $query = null)
{ {
if ($name instanceof Zend_Db_Expr) {
return $name;
}
if ($query === null || $this->validateQueryColumnAssociation($table, $name)) { if ($query === null || $this->validateQueryColumnAssociation($table, $name)) {
return parent::requireQueryColumn($table, $name, $query); return parent::requireQueryColumn($table, $name, $query);
} }
@ -657,6 +662,10 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
*/ */
public function requireFilterColumn($table, $name, RepositoryQuery $query = null, FilterExpression $filter = null) public function requireFilterColumn($table, $name, RepositoryQuery $query = null, FilterExpression $filter = null)
{ {
if ($name instanceof Zend_Db_Expr) {
return $name;
}
$joined = false; $joined = false;
if ($query === null) { if ($query === null) {
$column = $this->requireStatementColumn($table, $name); $column = $this->requireStatementColumn($table, $name);