Data\Filter: add setters for all properties

To keep our filter editor simple we want our filters to handle also
operations replacing themselves.
This commit is contained in:
Thomas Gelf 2014-06-20 11:57:31 +02:00
parent 97f88bf636
commit 18e49f6b9a
2 changed files with 22 additions and 0 deletions

View File

@ -78,6 +78,14 @@ abstract class FilterChain extends Filter
return $this->operatorName;
}
public function setOperatorName($name)
{
if ($name !== $this->operatorName) {
return Filter::chain($name, $this->filters);
}
return $this;
}
public function getOperatorSymbol()
{
return $this->operatorSymbol;

View File

@ -41,6 +41,20 @@ class FilterExpression extends Filter
return $this->expression;
}
public function setExpression($expression)
{
$this->expression = $expression;
return $this;
}
public function setSign($sign)
{
if ($sign !== $this->sign) {
return Filter::expression($this->column, $sign, $this->expression);
}
return $this;
}
public function __toString()
{
$expression = is_array($this->expression) ?