@param EAVQueryHandlerInterface $queryHandler
@param FilterInterface          $filter

@return array
324067
protected function getDefaultFormOptions(EAVQueryHandlerInterface $queryHandler, FilterInterface $filter): array
    {
        $formOptions = $this->formOptions;
        try {
            $attributes = $queryHandler->getEAVAttributes($filter);
        } catch (MissingAttributeException $e) {
            return $formOptions;
        }
        if (1 === \count($attributes)) {
            $attribute = reset($attributes);
            $attributeFormOptions = $attribute->getFormOptions();
            $formOptions['label'] = (string) $attribute;
            $formOptions['translate_label'] = false;
            if (array_key_exists('translation_domain', $attributeFormOptions)) {
                $formOptions['translation_domain'] = $attributeFormOptions['translation_domain'];
            }
        }

        return $formOptions;
    }
49453
public function withFilter(Filter $filter)
    {
        if ($this->value->isNull()) {
            return null;
        }

        return $this->applyFilter($filter);
    }
1306564
private function getPageFilter($filterName, $storeId = null)
    {
        $pageFilters = $this->getPageFilters($storeId);
        if ($pageFilters && @$pageFilters->$filterName) {
            return (array)$pageFilters->$filterName;
        }
        return [];
    }
71170
protected function getResultFromEngine($filters, $sorting, $queryKeys)
    {
        return $this->engine->search($this->buildConditions($filters), $sorting, $queryKeys);
    }
1288955
public function isEAVFilter(FilterInterface $filter): bool
    {
        try {
            $this->getEAVAttributes($filter);

            return true;
        } catch (MissingAttributeException $e) {
            return false;
        }
    }
698567
protected function addFilters(QueryBuilder $queryBuilder, $filters = array())
    {
        foreach ($filters as $field => $value) {
            $methodName = sprintf('add%sFilter', ucfirst($field));
            if (method_exists($this, $methodName)) {
                // This field has a custom filtering method
                $this->$methodName($queryBuilder, $value);
                continue;
            }

            if (null === $value || '' === $value || (is_array($value) && 0 == count($value))) {
                // Skip: value is blank
                continue;
            }

            $field = $this->addEntityAlias($field);
            if (is_array($value)) {
                $queryBuilder->andWhere($queryBuilder->expr()->in($field, $value));
            } else {
                $queryBuilder->andWhere($queryBuilder->expr()->eq($field, $queryBuilder->expr()->literal($value)));
            }
        }

        return $queryBuilder;
    }
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;
    }
1357444
protected function applyFilter(QueryBuilder $queryBuilder, $alias, FilterNode $filter)
    {
        $queryBuilderPatcher = new QueryBuilderPatcher(new QueryExpressionBuilder());

        return $queryBuilderPatcher->patch($queryBuilder, $filter, new QueryContext($alias));
    }
1355326
private function parseFilters(TableInterface $table, Request $request)
    {
        $filters = [];

        $queryParams = $request->get($table->getFormId());

        foreach ($table->getAllFilters() as $filter) {
            if (isset($queryParams[$filter->getName()])) {
                $searchParamRaw = trim($queryParams[$filter->getName()]);
                if ($searchParamRaw != '') {
                    $filters[$filter->getName()] = $searchParamRaw;
                }
            }
        }

        return $filters;
    }
227261
public function getFilter(QueryBuilder $qb, $dqlAlias)
    {
        $children = [];
        foreach ($this->children as $spec) {
            if ($spec instanceof Filter) {
                $children[] = $spec->getFilter($qb, $dqlAlias);
            }
        }

        return call_user_func_array(array($qb->expr(), $this->expression), $children);
    }
1158955
public function filterRequest( $query_vars ) {
		/** @var $routes \WPEmerge\Routing\RouteInterface[] */
		$routes = $this->router->getRoutes();

		foreach ( $routes as $route ) {
			if ( ! $route instanceof HasQueryFilterInterface ) {
				continue;
			}

			if ( ! $route->isSatisfied( $this->request ) ) {
				continue;
			}

			$query_vars = $route->applyQueryFilter( $this->request, $query_vars );
			break;
		}

		return $query_vars;
	}
338132
public function addFilterHandler($filterName, $filterHandlerName, $priority = 50)
    {
        $this->addHandler(self::FILTER, $filterName, $filterHandlerName, $priority);
    }
881504
public function listResources($filter)
    {
        $collection = $this->getThisCollection();

        $queryBuilder = $this->filterQueryBuilder($filter, $collection);

        $countQueryBuilder = clone $queryBuilder;
        $countQueryBuilder->orders = null;
        $totalNumberOfRows = $countQueryBuilder->count();

        // Paginate resources
        $this->paginateQueryBuilder($queryBuilder, $filter);

        $returnedResources = $this->loadResourcesFromQueryBuilder($queryBuilder, $this->getThisCollection());

        return ForestResource::formatResourcesJsonApi($returnedResources, $totalNumberOfRows);
    }
1067831
public final function listing($query_filters, $filtering_flags = 0): IListing
	{
		foreach ($this->backends as $b => $backend) {
			$listing = $backend->listing($this, $query_filters, $filtering_flags);

			if ($listing) {
				//if ($this->debug_logger) {
				//	$this->debug_logger->afterListingCreated($backend, $listing, $query_filters);
				//}
				if ($this->after_listing_created) {
					$this->after_listing_created->emit($listing);
				}

				return $listing;
			}
		}
		throw new RuntimeException('Cannot create listing.');
	}
1288255
public function get($filter_id)
    {
        $filters = $this->getHandlers();
        return empty($filters[$filter_id]) ? array() : $filters[$filter_id];
    }
1077620
public function filterBy(array $filters, QueryBuilder $qb = null)
    {
        $filters = array_filter($filters, function ($filter) {
            return !empty($filter);
        });

        if (null === $qb) {
            $qb = $this->createFilterQueryBuilder();
        }

        foreach ($filters as $col => $value) {
            foreach ($this->getColumnParameters($col) as $colName => $colParam) {
                $compare = $this->getWhereOperator($col).'Where';

                if (in_array($col, $this->getLikeFilterColumns())) {
                    $qb
                        ->$compare(sprintf('%s LIKE :%s', $colName, $colParam))
                        ->setParameter($colParam, '%'.$value.'%')
                    ;
                }

                if (in_array($col, $this->getILikeFilterColumns())) {
                    $qb
                        ->$compare(sprintf('LOWER(%s) LIKE :%s', $colName, $colParam))
                        ->setParameter($colParam, '%'.strtolower($value).'%')
                    ;
                }

                if (in_array($col, $this->getEqualFilterColumns())) {
                    $qb
                        ->$compare(sprintf('%s = :%s', $colName, $colParam))
                        ->setParameter($colParam, $value)
                    ;
                }

                if (in_array($col, $this->getInFilterColumns())) {
                    $qb
                        ->$compare($qb->expr()->in(sprintf('%s', $colName), (array) $value))
                    ;
                }
            }
        }

        return $qb;
    }
919329
public function findFilterDataBySlug(Query $query, array $options)
    {
        if (!isset($options['request']) || get_class($options['request']) !== ServerRequest::class) {
            user_error('The request query option must exist and must be of type Cake\Http\ServerRequest.');
        }

        $encryptedFilterData = $this->_findEncryptedFilterData($query, $options['request'])->first();

        if ($encryptedFilterData) {
            $encryptedFilterData = $encryptedFilterData->toArray();
            return $this->_decodeFilterData($encryptedFilterData['filter_data']);
        }

        return [];
    }