FilterOr: override operator change for NOT

Replacing an OR filter with a NOT operator should return a NOT OR
when the OR contains more than one entry
This commit is contained in:
Thomas Gelf 2014-11-15 22:37:12 +01:00
parent 1f74c462d4
commit 44c96f0410
1 changed files with 8 additions and 0 deletions

View File

@ -20,6 +20,14 @@ class FilterOr extends FilterChain
return false;
}
public function setOperatorName($name)
{
if ($this->count() > 1 && $name === 'NOT') {
return Filter::not(clone $this);
}
return parent::setOperatorName($name);
}
public function andFilter(Filter $filter)
{
return Filter::matchAll($this, $filter);