From dfdc7d327b9c54a929f38b7ce7bcba34bd747080 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 30 Oct 2018 18:02:32 +0100 Subject: [PATCH] FilterRenderer: support SimpleQuery fixes #1670 --- library/vendor/ipl/Db/Zf1/FilterRenderer.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/library/vendor/ipl/Db/Zf1/FilterRenderer.php b/library/vendor/ipl/Db/Zf1/FilterRenderer.php index b8526caa..67d54229 100644 --- a/library/vendor/ipl/Db/Zf1/FilterRenderer.php +++ b/library/vendor/ipl/Db/Zf1/FilterRenderer.php @@ -8,6 +8,7 @@ use Icinga\Data\Filter\FilterChain; use Icinga\Data\Filter\FilterExpression; use Icinga\Data\Filter\FilterNot; use Icinga\Data\Filter\FilterOr; +use Icinga\Data\SimpleQuery; use InvalidArgumentException; use RuntimeException; use Zend_Db_Adapter_Abstract as DbAdapter; @@ -44,12 +45,16 @@ class FilterRenderer return new DbExpr($this->render()); } - public static function applyToQuery(Filter $filter, DbSelect $query) + public static function applyToQuery(Filter $filter, $query) { if (! $filter->isEmpty()) { - $renderer = new static($filter, $query->getAdapter()); - $renderer->extractColumnMap($query); - $query->where($renderer->toDbExpression()); + if ($query instanceof DbSelect) { + $renderer = new static($filter, $query->getAdapter()); + $renderer->extractColumnMap($query); + $query->where($renderer->toDbExpression()); + } elseif ($query instanceof SimpleQuery) { + $query->applyFilter($filter); + } } return $query;