mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
Data\Filter: add or/andFilter implementations
Those shortcuts make it easy to correctly add or/and conditions regardless of the original filter type
This commit is contained in:
parent
6aefc4b491
commit
925348d171
@ -30,6 +30,10 @@ abstract class Filter
|
|||||||
|
|
||||||
abstract public function toQueryString();
|
abstract public function toQueryString();
|
||||||
|
|
||||||
|
abstract public function andFilter(Filter $filter);
|
||||||
|
|
||||||
|
abstract public function orFilter(Filter $filter);
|
||||||
|
|
||||||
public function getUrlParams()
|
public function getUrlParams()
|
||||||
{
|
{
|
||||||
return UrlParams::fromQueryString($this->toQueryString());
|
return UrlParams::fromQueryString($this->toQueryString());
|
||||||
|
@ -30,4 +30,14 @@ class FilterAnd extends FilterChain
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function andFilter(Filter $filter)
|
||||||
|
{
|
||||||
|
return $this->addFilter($filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function orFilter(Filter $filter)
|
||||||
|
{
|
||||||
|
return Filter::matchAny($this, $filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,4 +107,14 @@ class FilterExpression extends Filter
|
|||||||
return (bool) preg_match($pattern, $row->{$this->column});
|
return (bool) preg_match($pattern, $row->{$this->column});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function andFilter(Filter $filter)
|
||||||
|
{
|
||||||
|
return Filter::matchAll($this, $filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function orFilter(Filter $filter)
|
||||||
|
{
|
||||||
|
return Filter::matchAny($this, $filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,16 @@ class FilterNot extends FilterChain
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function andFilter(Filter $filter)
|
||||||
|
{
|
||||||
|
return Filter::matchAll($this, $filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function orFilter(Filter $filter)
|
||||||
|
{
|
||||||
|
return Filter::matchAny($filter);
|
||||||
|
}
|
||||||
|
|
||||||
public function toQueryString()
|
public function toQueryString()
|
||||||
{
|
{
|
||||||
$parts = array();
|
$parts = array();
|
||||||
|
@ -19,4 +19,14 @@ class FilterOr extends FilterChain
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function andFilter(Filter $filter)
|
||||||
|
{
|
||||||
|
return Filter::matchAll($this, $filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function orFilter(Filter $filter)
|
||||||
|
{
|
||||||
|
return $this->addFilter($filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user