Filter by date
@param  Filter\FilterDate $filter
@return void
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
			}
		}
	}
523688
public function filter($filter)
    {
        if (is_array($filter)) {
            $filter = new Filter($filter);
        }
        $this->filter = $filter;
        return $this;
    }
18397
public function filter(ODataQueryFilterInterface $filter = NULL) {
        if (isset($filter)) {
            $this->setFilter($filter);
            return $this;
        }
        return $this->getFilter();
    }
1054288
public function applyFilterMultiSelect(Filter\FilterMultiSelect $filter)
	{
		$condition = $filter->getCondition();
		$values = $condition[$filter->getColumn()];
		$or = [];

		if (sizeof($values) > 1) {
			$value1 = array_shift($values);
			$length = sizeof($values);
			$i = 1;

			$this->data_source->where('(%n = ?', $filter->getColumn(), $value1);

			foreach ($values as $value) {
				if ($i == $length) {
					$this->data_source->or('%n = ?)', $filter->getColumn(), $value);
				} else {
					$this->data_source->or('%n = ?', $filter->getColumn(), $value);
				}

				$i++;
			}
		} else {
			$this->data_source->where('%n = ?', $filter->getColumn(), reset($values));
		}
	}
1182930
public function applyFilterText(Filter\FilterText $filter)
	{
		$condition = $filter->getCondition();
		$exprs = [];

		foreach ($condition as $column => $value) {
			$c = $this->checkAliases($column);

			if ($filter->isExactSearch()) {
				$exprs[] = $this->data_source->expr()->eq($c, $this->data_source->expr()->literal($value));
				continue;
			}

			if ($filter->hasSplitWordsSearch() === false) {
				$words = [$value];
			} else {
				$words = explode(' ', $value);
			}

			foreach ($words as $word) {
				$exprs[] = $this->data_source->expr()->like($c, $this->data_source->expr()->literal("%$word%"));
			}
		}

		$or = call_user_func_array([$this->data_source->expr(), 'orX'], $exprs);

		$this->data_source->andWhere($or);
	}
327249
public function whereSearch($filters)
    {
        foreach ($this->queries as $query) {
            $query->whereSearch($filters);
        }

        return $this;
    }
731620
public function withFilter($filter) {
        if (!in_array($filter, [self::ALL, self::ANY, self::SOME, self::EXISTS, self::NOT_EXISTS, self::IN, self::NOT_IN], true)) {
            throw new InvalidArgumentException('Invalid filter type for sub-query');
        }

        $this->_filter = $filter;

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

				$this->data_source = $this->data_source->findBy([
					$this->prepareColumn($column) . '>=' => $date->setTime(0, 0, 0),
					$this->prepareColumn($column) . '<=' => $date_end->setTime(23, 59, 59),
				]);
			} catch (DataGridDateTimeHelperException $ex) {
				// ignore the invalid filter value
			}
		}

		return $this;
	}
435311
public function setAllowFilters(array $filters = []): void
    {
        $this->allowFilters = [];
        foreach ($filters as $column) {
            $this->addAllowFilter($column);
        }
    }
411599
public function addFilter(FilterInterface $filter) {
        if ($filter->supportsType($this->getType())) {
            $this->filters[] = $filter;
        }
        return $this;
    }
148423
public function setFilter(FilterQuery $filter)
    {
        $this->result = array_merge($this->result, $filter->toArray()['bool']);

        return $this;
    }
617009
private function filtersDateOverrides(array $filters): array
    {
        foreach ($filters as $key => $filter) {
            $builderType = $filter['type'];

            switch ($builderType) {
                case 'date':
                    $filter['validation'] = [
                        'format' => 'YYYY/MM/DD',
                    ];
                    $filter['plugin'] = 'datetimepicker';
                    $filter['plugin_config'] = [
                        'format' => 'YYYY/MM/DD',
                    ];

                    break;
                case 'datetime':
                    $filter['validation'] = [
                        'format' => 'YYYY/MM/DD HH:mm',
                    ];
                    $filter['plugin'] = 'datetimepicker';
                    $filter['plugin_config'] = [
                        'format' => 'YYYY/MM/DD HH:mm',
                    ];

                    break;
                case 'time':
                    $filter['validation'] = [
                        'format' => 'HH:mm',
                    ];
                    $filter['plugin'] = 'datetimepicker';
                    $filter['plugin_config'] = [
                        'format' => 'HH:mm',
                    ];

                    break;
            }

            $filters[$key] = $filter;
        }

        return $filters;
    }
1052485
public function filter(array $filters)
	{
		foreach ($filters as $filter) {
			if ($filter->isValueSet()) {
				if ($filter->hasConditionCallback()) {
					Callback::invokeArgs(
						$filter->getConditionCallback(),
						[$this->data_source, $filter->getValue()]
					);
				} else {
					if ($filter instanceof Filter\FilterText) {
						$this->applyFilterText($filter);
					} elseif ($filter instanceof Filter\FilterMultiSelect) {
						$this->applyFilterMultiSelect($filter);
					} elseif ($filter instanceof Filter\FilterSelect) {
						$this->applyFilterSelect($filter);
					} elseif ($filter instanceof Filter\FilterDate) {
						$this->applyFilterDate($filter);
					} elseif ($filter instanceof Filter\FilterDateRange) {
						$this->applyFilterDateRange($filter);
					} elseif ($filter instanceof Filter\FilterRange) {
						$this->applyFilterRange($filter);
					}
				}
			}
		}

		return $this;
	}
854024
private function addExpiration(
        &$filters = [],
        \DateTime $dateSend = null
    ) {
        if ($filters) {
            $expiration = $dateSend ? $dateSend : new \DateTime();
            $expiration = $expiration->getTimestamp();
            foreach ($filters as &$filter) {
                $filter['exclusive_expire_date'] = $expiration;
            }
        }
    }
367995
public function applyFilterText(Filter\FilterText $filter)
	{
		$exprs = [];

		foreach ($filter->getCondition() as $column => $value) {
			if ($filter->isExactSearch()) {
				$exprs[] = Criteria::expr()->eq($column, $value);
				continue;
			}

			if ($filter->hasSplitWordsSearch() === false) {
				$words = [$value];
			} else {
				$words = explode(' ', $value);
			}

			foreach ($words as $word) {
				$exprs[] = Criteria::expr()->contains($column, $word);
			}
		}

		$expr = call_user_func_array([Criteria::expr(), 'orX'], $exprs);
		$this->criteria->andWhere($expr);
	}
1201885
public function forFilterId($filterId)
    {
        $filter = $this->agenda->getFilter($filterId);
        if ($filter) {
            return $this->forFilter($filter);
        }

        return $this;
    }
709558
protected function processFilter(\Zend_Controller_Request_Abstract $request, array $filter)
    {
        $defaults = $this->getDefaultSearchData();

        $this->dateFactor = $this->processFilterName(self::DATE_FACTOR, $request, $filter, $defaults);
        $this->dateGroup  = $this->processFilterName(self::DATE_GROUP, $request, $filter, $defaults);
        $this->dateType   = $this->processFilterName(self::DATE_TYPE, $request, $filter, $defaults);

        unset($filter[self::DATE_FACTOR], $filter[self::DATE_GROUP], $filter[self::DATE_TYPE]);

        $model = $this->getModel();

        return $filter;
    }