Bolt\Storage\Query\QueryParameterParser::getFilter PHP Метод

getFilter() публичный Метод

Runs the keys/values through the relevant parsers.
public getFilter ( string $key, mixed $value = null ) : Filter | null
$key string
$value mixed
Результат Filter | null
    public function getFilter($key, $value = null)
    {
        if (!$this->expr instanceof ExpressionBuilder) {
            throw new QueryParseException('Cannot call method without an Expression Builder parameter set', 1);
        }
        /** @var callable $callback */
        foreach ($this->filterHandlers as $callback) {
            $result = $callback($key, $value, $this->expr);
            if ($result instanceof Filter) {
                return $result;
            }
        }
        return null;
    }

Usage Example

Пример #1
0
 /**
  * Internal method that runs the individual key/value input through
  * the QueryParameterParser. This allows complicated expressions to
  * be turned into simple sql expressions
  */
 protected function processFilters()
 {
     $this->filters = [];
     foreach ($this->params as $key => $value) {
         $this->parser->setAlias($this->contentType);
         $filter = $this->parser->getFilter($key, $value);
         if ($filter) {
             $this->addFilter($filter);
         }
     }
 }
All Usage Examples Of Bolt\Storage\Query\QueryParameterParser::getFilter