Filter: allow to list all filtered columns

This is important for backends that need to know which additional columns
to fetch.

refs #4787
This commit is contained in:
Thomas Gelf 2014-11-11 19:09:59 +01:00
parent e96ecc5271
commit 8987b69d55
3 changed files with 21 additions and 0 deletions

View File

@ -52,6 +52,8 @@ abstract class Filter
return false === strpos($this->id, '-');
}
abstract public function listFilteredColumns();
public function applyChanges($changes)
{
$filter = $this;

View File

@ -117,6 +117,20 @@ abstract class FilterChain extends Filter
return $this->operatorSymbol;
}
public function listFilteredColumns()
{
$columns = array();
foreach ($this->filters as $filter) {
if ($filter instanceof FilterExpression) {
$columns[] = $filter->getColumn();
} else {
$columns += $filter->listFilteredColumns();
}
}
// array_unique?
return $columns;
}
public function toQueryString()
{
$parts = array();

View File

@ -59,6 +59,11 @@ class FilterExpression extends Filter
return $this;
}
public function listFilteredColumns()
{
return array($this->getColumn());
}
public function __toString()
{
$expression = is_array($this->expression) ?