Sets up filtering rules for the query.

@param null $filterType
@param null $filterField
@param null $filterValue
@return $this
197184
public function makeFilter(
        $filterType = null,
        $filterField = null,
        $filterValue = null
    ) {
        if ($filterType === null &&
            $filterField === null &&
            $filterValue === null)
            $this->filter = array();
        else
            $this->filter = array(
                'filter_type' => $filterType,
                'filter_field' => $filterField,
                'filter_value' => $filterValue
            );

        return $this;
    }
500263
public function withFilters(array $filters = null)
    {
        if ($filters) {
            foreach ($filters as $filter) {
                switch ($filter['type']) {
                    case 'select':
                        $this->select($filter['fields']);
                        break;
                    case 'andWhere':
                        $this->andWhere($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'orWhere':
                        $this->orWhere($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'andHaving':
                        $this->andHaving($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'orHaving':
                        $this->orHaving($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'addGroupBy':
                        $this->addGroupBy($filter['field']);
                        break;
                    case 'addOrderBy':
                        $this->addOrderBy($filter['field'], $filter['order']);
                        break;
                    case 'fkAddOrderBy':
                        $this->fkAddOrderBy($filter['field'], $filter['fkField'], $filter['order']);
                        break;
                    case 'paginate':
                        if (isset($filter['page'])) {
                            $this->paginate($filter['limit'], $filter['page']);
                        } else {
                            $this->paginate($filter['limit']);
                        }
                        break;
                }
            }
        }

        return $this;
    }
437576
public function add(FilterRule $rule)
    {
        $this->rules[$rule->getName()] = $rule;

        if (!\is_null($rule->getValue())) {
            $this->hasDefaults = true;
        }

        return $this;
    }
929023
def add_filter_by_extension(self, extensions, filter_type=DefaultFilterType):
        
        self.add_filter(FilterExtension(extensions), filter_type)
        return self
239475
func (s *CampaignEventFilter) SetFilterType(v string) *CampaignEventFilter {
	s.FilterType = &v
	return s
}
1034958
func (s *ListPhoneNumbersInput) SetFilterValue(v string) *ListPhoneNumbersInput {
	s.FilterValue = &v
	return s
}
1002674
private static void parseFilters(final FilterType filterType, final WebApp webApp) {
		final WebAppFilter filter = new WebAppFilter();
		if (filterType.getFilterName() != null) {
			filter.setFilterName(filterType.getFilterName().getValue());
		}
		if (filterType.getFilterClass() != null) {
			filter.setFilterClass(filterType.getFilterClass().getValue());
		}

		if (filterType.getAsyncSupported() != null) {
			filter.setAsyncSupported(filterType.getAsyncSupported().isValue());
		}

		webApp.addFilter(filter);
		List<ParamValueType> initParams = filterType.getInitParam();
		if (initParams != null && initParams.size() > 0) {
			for (ParamValueType initParamElement : initParams) {
				final WebAppInitParam initParam = new WebAppInitParam();
				initParam.setParamName(initParamElement.getParamName().getValue());
				initParam.setParamValue(initParamElement.getParamValue().getValue());
				filter.addInitParam(initParam);
			}
		}

		List<DescriptionType> description = filterType.getDescription();
		for (DescriptionType descriptionType : description) {
			filter.addDispatcherType(DispatcherType.valueOf(descriptionType.getValue()));
		}
	}
1078731
protected function addRule(FilterRule $rule)
    {
        if ($this->keys === null) {
            $this->filter->addFilterRule($rule);
        }

        if (is_array($this->keys)) {
            foreach ($this->keys as $key) {
                $this->filter->addFilterRule($rule, $key);
            }
        } else {
            $this->filter->addFilterRule($rule, $this->keys);
        }

        return $this;
    }
1196180
public static function where($filter, $value = null)
    {
        if (is_scalar($filter)) {
            /** @var \ManaPHP\ModelInterface $model */
            $model = Di::getDefault()->getShared(static::class);
            return static::query(null, $model)->whereEq($model->getPrimaryKey(), $filter);
        } else {
            return static::query()->where($filter, $value);
        }
    }
949538
public function filter($isSet, $value = null, $filterData = null)
    {
        /** @var FilterRule $rule */
        foreach ($this->rules as $rule) {
            $rule->setFilterData($filterData);

            if ($isSet || $rule->allowedNotSet()) {
                $value = $rule->filter($value);
                $isSet = $rule->isNotEmpty();
            }
        }

        return new FilterResult($isSet, $value);
    }
1288930
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) {
		if (!in_array($pFilterType,self::$_filterTypes)) {
			throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.');
		}

		$this->_filterType = $pFilterType;

		return $this;
	}
968585
public function applyFilterDate(Filter\FilterDate $filter)
	{
		foreach ($filter->getCondition() as $column => $value) {
			try {
				$date = DateTimeHelper::tryConvertToDateTime($value, [$filter->getPhpFormat()]);

				$from = Criteria::expr()->gte($filter->getColumn(), $date->format('Y-m-d 00:00:00'));
				$to = Criteria::expr()->lte($filter->getColumn(), $date->format('Y-m-d 23:59:59'));

				$this->criteria->andWhere($from)->andWhere($to);
			} catch (DataGridDateTimeHelperException $ex) {
				// ignore the invalid filter value
			}
		}
	}
1086265
public function _prepareAsFilterValue()
    {
        if (is_null($this->_fields)) {
            $queryset = $this->asArray(['pk']);
        } else {
            if (count($this->_fields) > 1) {
                throw new TypeError('Cannot use multi-field values as a filter value.');
            }
            $queryset = $this->_clone();
        }

        return $queryset->query->toSubQuery($queryset->connection);
    }
1235917
public function filter($var, $filters, $type = null)
    {
        if (!is_array($filters)) {
            $filters = $filters ? explode('|', $filters) : [];
        }

        $value = &$this->data[$var] ?? null;
        if ($value === null) {
            return null;
        }
        foreach ($filters as $key => $filter) {
            $params = explode(':', $filter);
            $filter = is_string($key) ? $key : array_shift($params);
            $filter = $this->filters[$filter] ?? function (&$data) use ($filter, $params) {
                $data = $filter($data, ...$params);
            };

            $errors = $filter($value, ...$params);
            if ($errors) {
                $this->errors[$var] = $errors;
                break;
            }
            if ($value === null) {
                return null;
            }
        }

        if ($type) {
            settype($value, $type);
        }

        return $value;
    }
1209280
public function applyHash(&$filterValue, $filterKey)
    {
        if ('grs_ssn' === $filterKey) {
            $filterValue = $this->project->getValueHash($filterValue, $this->hashAlgorithm);
        }
    }
270782
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER)
    {
        if (!in_array($pFilterType, self::$filterTypes)) {
            throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.');
        }

        $this->filterType = $pFilterType;

        return $this;
    }
881225
public function actionFilter($filterName, $query = null)
    {
        $this->checkAccess('filter');
        
        $model = $this->model;
        
        $filterName = Html::encode($filterName);
        
        if (!array_key_exists($filterName, $model->ngRestFilters())) {
            throw new InvalidCallException("The requested filter '$filterName' does not exists in the filter list.");
        }

        $find = $model->ngRestFilters()[$filterName];

        if ($query) {
            foreach ($model->getNgRestPrimaryKey() as $pkName) {
                $searchQuery = $model->ngRestFullQuerySearch($query)->select([$model->tableName() . '.' . $pkName]);
                $find->andWhere(['in', $model->tableName() . '.' . $pkName, $searchQuery]);
            }
        }

        $this->appendPoolWhereCondition($find);
        
        return new ActiveDataProvider([
            'query' => $find,
            'pagination' => $this->pagination,
            'sort' => [
                'attributes' => $this->generateSortAttributes($model->getNgRestConfig()),
            ]
        ]);
    }