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:
parent
e96ecc5271
commit
8987b69d55
|
@ -52,6 +52,8 @@ abstract class Filter
|
|||
return false === strpos($this->id, '-');
|
||||
}
|
||||
|
||||
abstract public function listFilteredColumns();
|
||||
|
||||
public function applyChanges($changes)
|
||||
{
|
||||
$filter = $this;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) ?
|
||||
|
|
Loading…
Reference in New Issue