Applies the filter to the data list and answers the result.

@return DataList
171749
public function apply()
    {
        return $this->getDraftRecords()->leftJoin(
            $this->getLiveTable(),
            $this->getLeftJoinClause()
        )->where($this->getWhereClause());
    }
1226592
public function getFiltersDefault()
    {
        $filters = [];

        foreach ($this->getColumns() as $column) {
            /* @var $column \ZfcDatagrid\Column\AbstractColumn */
            if ($column->hasFilterDefaultValue() === true) {
                $filter = new Filter();
                $filter->setFromColumn($column, $column->getFilterDefaultValue());
                $filters[] = $filter;

                $column->setFilterActive($filter->getDisplayColumnValue());
            }
        }

        return $filters;
    }
691449
public function apply_filters() {
		$args = func_get_args();
		$tag  = current( array_splice( $args, 1, 1 ) );
		return apply_filters_ref_array( $tag, $args );
	}
926085
public function apply()
    {
        $records = $this->getLiveRecords();
        
        if ($ids = $this->getDraftIds()) {
            $records = $records->exclude('ID', $ids);
        }
        
        return $records;
    }
120657
public function getResults()
    {
        $key = $this->dataKey;
        $content = $this->content;

        if (is_object($content) && property_exists($content, $key)) {
            return new Collection($content->{$key});
        } elseif (is_array($content)) {
            return new Collection($content);
        }

        return $content;
    }
135904
public function activeFilters()
    {
        $state = $this->activeState();

        $result = [];
        foreach ($state->activeFilters() as $name) {
            if (!isset($this->filters[$name])) {
                //No such filter
                continue;
            }

            $filter = $this->filters[$name];
            $value = $state->getValue($name);

            if ($filter->isApplicable($value)) {
                $result[$name] = $filter->withValue($value);
            }
        }

        return $result;
    }
656084
public function apply()
    {
        $filters   = $this->filters;
        $inputs    = $this->inputs;
        $assistant = $this->assistant;

        if (count($filters)) {
            foreach ($filters as $name => $filter) {
                
                // Allow filter to defined as array or pipe delimited string
                $rules = (is_array($filter)) ? $filter : explode('|', $filter);

                // At least a rule is set and the input
                // field exists.
                if (count($rules) and isset($inputs[$name])) {
                    foreach ($rules as $rule) {
                        $splitAt = strpos($rule, ':');

                        $argument = null;
                        if ($splitAt) {
                            $argument = substr($rule, $splitAt+1);
                            $rule = substr($rule, 0, $splitAt);
                        }

                        $rule = strtolower($rule);
                        $rule = str_replace('_', ' ', $rule);
                        $rule = str_replace(' ', '', ucwords($rule));

                        $method = 'filter'.$rule;

                        // Check if rule is defined as a class method.
                        if (method_exists($this, $method)) {
                            $inputs[$name] = $this->$method($inputs[$name], $argument);
                        }

                        // Check if ValidatorAssistant object has the same/custom filter defined
                        if ( $assistant && method_exists($assistant, $method)) {
                            $inputs[$name] = $assistant->$method($inputs[$name], $argument);
                        }
                    }
                }
            }
        }

        return $inputs;
    }
1253361
protected function getListStore()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;

        return $this->store->getList($conditions);
    }
1301720
protected function checkFilters()
    {
        if ($this->getModelInformation()->list->disable_filters) {
            return $this;
        }

        if ($this->getListMemory()->hasFilters()) {
            $this->retrieveFiltersFromSession();
        }

        return $this;
    }
999207
public function execute() {
		$results = ArrayList::create();
		foreach($this->classes as $c) {

			if($this->isOmitted($c)) continue;

			$list = DataList::create($c)
						->filter('ClassName', $c)
						->limit($this->getLimitFor($c))
						->sort("RAND()");

			foreach($list as $record) {
				$results->push($record);
			}
		}

		return $results;		
	}
439579
protected function getListFieldValue()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;
        $conditions['field_id'] = $this->data_field['field_id'];

        $list = (array) $this->field_value->getList($conditions);
        $this->prepareListFieldValue($list);
        return $list;
    }
1256011
protected function applyFilters()
    {
        // skip if already cleaned
        if ($this->currentState == self::FILTERED) {
            return $this->wasFiltered();
        }

        $this->filterMessages = array();

        // skip if not translations available
        if (!$this->hasTranslations()) {
            $this->currentState = self::FILTERED;
            return false;
        }

        $cleanedTranslations = $this->translations;

        foreach ($this->filters as $filter) {

            $cleanedTranslations = $filter->filter($cleanedTranslations);
            $filteredData = $filter->getFilteredData();
            if (!empty($filteredData)) {
                $this->filterMessages[] = get_class($filter) . " changed: " . var_export($filteredData, 1);
            }
        }

        $this->currentState = self::FILTERED;

        if ($cleanedTranslations != $this->translations) {
            $this->filterMessages[] = 'translations have been cleaned';
        }

        $this->translations = $cleanedTranslations;
        return $this->wasFiltered();
    }
904168
function filter($data = array())
    {
        if (! is_array($data)) {
            return $data;
        }
        // first apply the filters to the ROOT
        if (isset($this->filters[self::SELECTOR_ROOT])) {
            /* @var $rootFilters FilterSet */
            $rootFilters = $this->filters[self::SELECTOR_ROOT];
            $data = $rootFilters->applyFilters($data);
        }
        foreach ($data as $key => $value) {
            $data[$key] = $this->filterItem($data, $key);
        }
        return $data;
    }
799598
public function applyFilter() {
        foreach($this->getFormElements() as $name => $child) {
            $this->value->offsetSet($name, $child->getValue(TRUE));
        }
    }
146205
public function addAllFilters()
    {
        $fields = array_keys($this->getDataObjectInstance()->searchableFields());
        foreach ($fields as $fieldName) {
            $this->addDefaultFilters($fieldName);
        }

        return $this;
    }
444704
public function getList()
    {
        if ($this->modelClass === TaxonomyTerm::class) {
            $list = parent::getList();
            return $list->filter('ParentID', '0');
        }
        return parent::getList();
    }
692102
protected function applyMetaFilters()
	{
		if (isset($this->meta_filters_applied)) {
			return $this->meta_filters_applied;
		}
		
		if (empty($this->filters)) {
			return $this->meta_filters_applied = false;
		}
		
		$meta_model = $this->model->metaModel();
		$meta_instance = new $meta_model;
		$meta_query = $meta_instance->newQuery();
		
		if (isset($this->meta_context)) {
			if (method_exists($meta_model, 'applyQueryContext')) {
				call_user_func_array(array($meta_model, 'applyQueryContext'), array($meta_query, $this->meta_context));
			}
		}
		
		$filters = $this->filters;
		$meta_query->where(function ($query) use ($filters) {
			foreach ($filters as $filter) {
				foreach ($filter['metas'] as $sub_filter) {
					if (isset($sub_filter['id'])) {
						$query->orWhere('id', $sub_filter['id']);
					}
					else if (isset($sub_filter['name'])) {
						$query->orWhere('name', $sub_filter['name']);
					}
				}
			}
		});
		
		$metas = $meta_query->get();
		$meta_items = $metas->lists('num_items', 'id');
		
		$found = array(
			'id'   => $metas->lists('id', 'id'),
			'name' => $metas->lists('id', 'name'),
		);
		
		foreach ($filters as &$filter) {
			$found_one = false;
			
			foreach ($filter['metas'] as $idx => &$sub_filter) {
				$key = isset($sub_filter['id']) ? 'id' : 'name';
				$key_value = $sub_filter[$key];
				
				if (!array_key_exists($key_value, $found[$key])) {
					unset($filter['metas'][$idx]);
					continue;
				}
				
				$found_one = true;
				$sub_filter['id'] = $found[$key][$key_value];
				
				$num_items = $meta_items[$found[$key][$key_value]];
				if (!isset($filter['num_items']) || $num_items > $filter['num_items']) {
					$filter['num_items'] = $num_items;
				}
			}
			
			if (!$found_one) {
				return $this->meta_filters_applied = false;
			}
			
			if (count($filter['metas']) > 1) {
				$filter['num_items'] += 100000000;
			}
		}
		
		usort($filters, function ($a, $b) {
			return ($a['num_items'] < $b['num_items']) ? -1 : 1;
		});
		
		$set_distinct = false;
		
		$first_filter = current(array_splice($filters, 0, 1));
		if (count($first_filter['metas']) > 1) {
			$this->where(function ($query) use ($first_filter) {
				foreach ($first_filter['metas'] as $f) {
					if (isset($f['value'])) {
						$query->orWhere(function ($query) use ($f) {
							$query->where('m.meta_id', $f['id']);
							$query->where('m.value', $f['operator'], $f['value']);
						});
					}
					else {
						$query->orWhere('m.meta_id', $f['id']);
					}
				}
			});
			
			if (!$set_distinct) {
				$this->distinct();
				$set_distinct = true;
			}
		}
		else {
			foreach ($first_filter['metas'] as $f) {
				$this->where('m.meta_id', $f['id']);
				if (isset($f['value'])) {
					$this->where('m.value', $f['operator'], $f['value']);
				}
			}
		}
		
		foreach ($filters as $i => $cur_filter) {
			$this->join("{$this->model->metableTable()} AS m{$i}", function ($join) use ($i, $cur_filter) {
				$join_query = $join->on('m.xref_id', '=', "m{$i}.xref_id");
				
				if (count($cur_filter['metas']) <= 1) {
					foreach ($cur_filter['metas'] as $f) {
						if (isset($f['value'])) {
							$join_query->where("m{$i}.meta_id", '=', $f['id']);
							$join_query->where("m{$i}.value", $f['operator'], $f['value']);
						}
						else {
							$join_query->where("m{$i}.meta_id", '=', $f['id']);
						}
					}
				}
			});
			
			if (count($cur_filter['metas']) > 1) {
				$this->where(function ($query) use ($cur_filter, $i) {
					foreach ($cur_filter['metas'] as $f) {
						if (isset($f['value'])) {
							$query->orWhere(function ($query2) use ($f, $i) {
								$query2->where("m{$i}.meta_id", $f['id']);
								$query2->where("m{$i}.value", $f['operator'], $f['value']);
							});
						}
						else {
							$query->orWhere("m{$i}.meta_id", $f['id']);
						}
					}
				});
				
				if (!$set_distinct) {
					$this->distinct();
					$set_distinct = true;
				}
			}
		}
		
		return $this->meta_filters_applied = true;
	}