@param object     $qb
@param FilterRule $rule
@param string     $column

@throws \LogicException
771177
public function process($qb, FilterRule $rule, $column)
    {
        foreach ($this->filterRuleProcessors as $filterRoleProcessor) {
            if ($filterRoleProcessor->supports($qb, $rule, $column)) {
                $filterRoleProcessor->process($qb, $rule, $column);

                return;
            }
        }

        throw new \LogicException(\sprintf(
            'Couldn\'t find any filter rule processor suitable to filter rule "%s" and column "%s"',
            $rule->getName(),
            $column
        ));
    }
232727
protected function applyFilter(RestRequestContract $request, QueryBuilder $qb)
    {
        $entity = $this->base()->findById($request->getId());

        $relateCriteria = Criteria::create();
        $relateCriteria->andWhere($relateCriteria->expr()->eq($this->mappedBy(), $entity->getId()));

        $qb->innerJoin($qb->getRootAliases()[0].'.'.$this->mappedBy(), $this->mappedBy());
        $qb->addCriteria($relateCriteria);

        parent::applyFilter($request, $qb);
    }
678645
private function setWhere(QueryBuilder $qb)
    {
        $globalSearch = $this->requestParams['search']['value'];

        // global filtering
        if ('' != $globalSearch) {
            $orExpr = $qb->expr()->orX();

            foreach ($this->columns as $key => $column) {
                if (true === $this->isSearchColumn($column)) {
                    $searchField = $this->searchColumns[$key];
                    $orExpr->add($qb->expr()->like($searchField, '?'.$key));
                    $qb->setParameter($key, '%'.$globalSearch.'%');
                }
            }

            $qb->where($orExpr);
        }

        // individual filtering
        if (true === $this->individualFiltering) {
            $andExpr = $qb->expr()->andX();

            $i = 100;

            foreach ($this->columns as $key => $column) {
                if (true === $this->isSearchColumn($column)) {
                    $searchType = $column->getSearchType();
                    $searchField = $this->searchColumns[$key];
                    $searchValue = $this->requestParams['columns'][$key]['search']['value'];
                    $searchRange = $this->requestParams['columns'][$key]['name'] === 'daterange';
                    if ('' != $searchValue && 'null' != $searchValue) {
                        if ($searchRange) {
                            list($_dateStart, $_dateEnd) = explode(' - ', $searchValue);
                            $dateStart = new \DateTime($_dateStart);
                            $dateEnd = new \DateTime($_dateEnd);
                            $dateEnd->setTime(23, 59, 59);

                            $k = $i + 1;
                            $andExpr->add($qb->expr()->between($searchField, '?'.$i, '?'.$k));
                            $qb->setParameter($i, $dateStart->format('Y-m-d H:i:s'));
                            $qb->setParameter($k, $dateEnd->format('Y-m-d H:i:s'));
                            $i += 2;
                        } else {
                            $andExpr = $this->addCondition($andExpr, $qb, $searchType, $searchField, $searchValue, $i);
                            ++$i;
                        }
                    }
                }
            }

            if ($andExpr->count() > 0) {
                $qb->andWhere($andExpr);
            }
        }

        return $this;
    }
647510
public function getFilter(QueryBuilder $qb, $dqlAlias)
    {
        $qb->select(sprintf('COUNT(%s)', $dqlAlias));

        if ($this->child instanceof Filter) {
            return $this->child->getFilter($qb, $dqlAlias);
        }

        return '';
    }
1306996
public static function search (string $column, string $searchQ, int $limit=0, string $order="DESC")
	{
		$order = static::validateOrder($order);
		return static::limitFindBySql("SELECT * FROM ".static::$tableName." WHERE {$column} LIKE '%$searchQ%' ORDER BY id {$order}", $limit);
	}
553821
public function applySorter($qb, SorterInterface $sorter, QueryObjectInterface $queryObject)
    {
        if ($queryObject instanceof SortableQueryObjectInterface) {
            // default sorting if no sorter rules exists
            if (0 === $sorter->count() && 0 < \count($queryObject->getDefaultSort())) {
                $sorter->setSorterRules($queryObject->getDefaultSort());
            }

            $this->getBuilderFor($qb)->applySorter($qb, $sorter, $queryObject->getSorterMap());
        }
    }
1155509
public function buildQuery(QueryBuilder $qb, $alias)
    {
        $data = $this->getCleanParameter();
        $fieldName = $this->getFieldName($alias);
        $name = $this->getName();

        if (empty($data)) {
            return;
        }

        $comparison = $this->getComparison();
        $func = sprintf('and%s', ucfirst($this->getOption('clause')));

        switch ($comparison) {
            case 'eq':
                $qb->$func($qb->expr()->eq($fieldName, ":$name"));
                $qb->setParameter($name, $data);
                break;

            case 'neq':
                $qb->$func($qb->expr()->neq($fieldName, ":$name"));
                $qb->setParameter($name, $data);
                break;

            case 'memberof':
                $qb->$func(":$name MEMBER OF $fieldName");
                $qb->setParameter($name, $data);
                break;

            case 'notmemberof':
                $qb->$func(":$name NOT MEMBER OF $fieldName");
                $qb->setParameter($name, $data);
                break;

            case 'in':
                $qb->$func("$fieldName IN (:$name)");
                $qb->setParameter($name, $data);
                break;

            case 'isNull':
                $qb->$func($fieldName . ' IS ' . ($data === 'null' ? '' : 'NOT ') . 'NULL');
                break;

            default:
                throw new DoctrineDriverException(sprintf('Unexpected comparison type ("%s").', $comparison));
        }
    }
418184
public function applyExprFromArray($qb, $alias, array $criteria)
	{
		$pos = 0;
		
		foreach ($criteria as $field => $exprValue) {
			$this->applyExprFromString($qb, $alias, $field, $exprValue, ':'.$field.($pos++));
		}
	}
411268
public function whereGreaterThan($column, $value, $filter = false)
    {
        return $this->where($column, '>', $value, $filter);
    }
210978
private function addWhereOptionalField(QueryBuilder $qb, $field, $value): void
    {
        if (null === $value) {
            $qb->andWhere('p.'.$field.' IS NULL');
        } else {
            $qb->andWhere('p.'.$field.' = :'.$field)->setParameter($field, $value);
        }
    }
776570
protected function addEnabledFilter(QueryBuilder $qb, $alias = 'translations')
    {
        $qb->andWhere($alias.'.enabled = :enabled')->setParameter('enabled', true);

        return $this;
    }
367072
public function filter(QueryBuilder $qb, $alias, $identifier, $search)
    {
        $qb->andWhere("LOWER({$alias}.{$identifier}) LIKE LOWER(:{$identifier})");
        $qb->setParameter($identifier, "%{$search}%");
    }
917115
public function apply(ColumnInterface $column, Builder $query, $queryString, $queryParams)
    {
        $queryString = $this->parseValue($queryString);

        if (($metaInstance = $column->getMetaData()) instanceof ColumnMetaInterface) {
            if (method_exists($metaInstance, 'onFilterSearch')) {
                $metaInstance->onFilterSearch($column, $query, $queryString, $queryParams);

                return;
            }
        }

        if (is_callable($callback = $column->getFilterCallback())) {
            $callback($column, $query, $queryString, $queryParams);

            return;
        }

        if (is_callable($callback = $this->getCallback())) {
            $callback($column, $query, $queryString, $queryParams);

            return;
        }

        if (empty($queryString) && strlen($queryString) == 0) {
            return;
        }

        if (is_null($name = $this->getColumnName())) {
            $name = $column->getName();
        }

        if (strpos($name, '.') !== false) {
            $parts = explode('.', $name);
            $fieldName = array_pop($parts);
            $relationName = implode('.', $parts);

            $query->whereHas($relationName, function ($q) use ($queryString, $fieldName) {
                $this->buildQuery($q, $fieldName, $queryString);
            });
        } else {
            $this->buildQuery($query, $name, $queryString);
        }
    }
526528
public function between($column, $value1, $value2, $logicalAnd = true) {
        $this->customWhere('`:TBL:`.`' . Util::camelTo_($column) . '` BETWEEN "'
                . $value1 . '" AND "' . $value2 . '" ',
                $logicalAnd ? 'AND' : 'OR');
    }
62286
public function of($column){
        ForUpdateOfImpl::of($this->context, $column);
        return new GetRule($this->context);
    }
844750
public function scopeFilterColumns($query, $columns = array(), $validate = false)
	{
		if ( sizeof($columns) > 0 ) {
			// Set columns that can be filtered
			$this->setColumns($columns);
		}
		// Validate columns
		if ( $validate ) {
			$this->validateColumns();	
		}
		// Ensure that query string is parsed at least once
		if ( sizeof($this->filterable['filters']) == 0 ) {
			$this->setQuerystring();
		}
		// Apply conditions to Eloquent query object
		if ( sizeof($this->filterable['filters']) > 0 ) {
			foreach ( $this->filterable['filters'] as $k => $v ) {
				$where = $v['boolean'];	
				if ( is_array($v['val']) ) {
					if ( isset($v['val']['start']) && isset($v['val']['end']) ) {
						// BETWEEN a AND b
						$query->whereBetween($k, array($v['val']['start'], $v['val']['end']));
					} else {
						// a = b OR c = d OR...
						$query->{$where}(function($q) use ($k, $v, $query)
						{
							foreach ( $v['val'] as $key => $val ) {
								$q->orWhere($k, $v['operator'], $val);	
							}	
						});
					}
				} else {
					// a = b
					$query->{$where}($k, $v['operator'], $v['val']);
				}
			}
		}
		// Apply callbacks
		if ( sizeof($this->filterable['callbacks']) > 0 ) {
			foreach ( $this->filterable['callbacks'] as $v ) {
				$v($query);	
			}
		}
		// Sorting
		if ( isset($this->filterable['qstring'][$this->filterable['orderby']]) && isset($this->filterable['columns'][$this->filterable['qstring'][$this->filterable['orderby']]]) ) {
			$order = isset($this->filterable['qstring'][$this->filterable['order']]) ? $this->filterable['qstring'][$this->filterable['order']] : 'asc';
			$query->orderBy($this->filterable['columns'][$this->filterable['qstring'][$this->filterable['orderby']]], $order);
		}
		return $query;
	}
686395
public function applyToQueryBuilder(QueryBuilder $qb, &$parameterOffset = 0)
	{
		$orderRules = $this->orderRules;
		foreach ($orderRules as $orderRule) {
			$field = $orderRule[self::FIELD_POS];
			switch ($field) {
				case self::LEFT_FIELD:
				case self::RIGHT_FIELD:
				case self::LEVEL_FIELD:
					break;
				default:
					throw new Exception\InvalidArgument("Field $field is not recognized");
			}

			$field = "e.$field";
			$directionSQL = null;;

			$direction = $orderRule[self::DIRECTION_POS];
			switch ($direction) {
				case self::DIRECTION_ASCENDING:
					$directionSQL = 'ASC';
					break;
				case self::DIRECTION_DESCENDING:
					$directionSQL = 'DESC';
					break;
				default:
					throw new Exception\InvalidArgument("Direction $direction is not recognized");
			}
			$qb->addOrderBy($field, $directionSQL);
		}
	}