From 3e8ef5cc0f86753794592b448027973f370d19b9 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 4 May 2015 16:17:14 +0200 Subject: [PATCH] Ldap\Query: Quick fix for naive filter support Since this will ignore any logical clauses and operators it must be considered a quick fix and be dropped once real filter support exists. refs #8826 --- library/Icinga/Protocol/Ldap/Query.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/library/Icinga/Protocol/Ldap/Query.php b/library/Icinga/Protocol/Ldap/Query.php index d923c8ebd..d5bf1f080 100644 --- a/library/Icinga/Protocol/Ldap/Query.php +++ b/library/Icinga/Protocol/Ldap/Query.php @@ -126,14 +126,17 @@ class Query extends SimpleQuery throw new NotImplementedError('Support for Icinga\Data\Filter is still missing. Use $this->where() instead'); } - public function applyFilter(Filter $filter) - { - throw new NotImplementedError('Support for Icinga\Data\Filter is still missing. Use $this->where() instead'); - } - public function addFilter(Filter $filter) { - throw new NotImplementedError('Support for Icinga\Data\Filter is still missing. Use $this->where() instead'); + // TODO: This should be considered a quick fix only. + // Drop this entirely once support for Icinga\Data\Filter is available + if ($filter->isExpression()) { + $this->where($filter->getColumn(), $filter->getValue()); + } elseif ($filter->isChain()) { + foreach ($filter->filters() as $chainOrExpression) { + $this->addFilter($chainOrExpression); + } + } } public function setFilter(Filter $filter)