Bolt\Storage\Query\Filter::setKey PHP Method

setKey() public method

Sets the key that this filter affects.
public setKey ( string $key )
$key string
    public function setKey($key)
    {
        $this->key = $key;
    }

Usage Example

 /**
  * The default handler is the last to be run and handler simple value parsing.
  *
  * @param string            $key
  * @param string            $value
  * @param ExpressionBuilder $expr
  *
  * @return Filter
  */
 public function defaultFilterHandler($key, $value, $expr)
 {
     $val = $this->parseValue($value);
     $placeholder = $key . '_1';
     $exprMethod = $val['operator'];
     $filter = new Filter();
     $filter->setKey($key);
     $filter->setExpression($expr->andX($expr->{$exprMethod}($this->alias . $key, ":{$placeholder}")));
     $filter->setParameters([$placeholder => $val['value']]);
     return $filter;
 }