\Search\Model\SearchRangeOperator

Handles range-based operators. Values must be separated using ".

." characters and follow the pattern ".." For instance:

age:15..21

This class can handle ranges given in incorrect order <upper>..<lower>. For instance: age:21..15. In these cases this class will treat values as numeric values for determinate the correct order.

Summary

Methods
Properties
Constants
scope()
__construct()
No public properties found
No constants found
_parseRange()
$_defaultConfig
$_table
N/A
No private methods found
No private properties found
N/A

Properties

$_defaultConfig

$_defaultConfig : array

Default configuration for this operator.

Type

array

$_table

$_table : \Cake\ORM\Table

The table for which handle this operator.

Type

\Cake\ORM\Table

Methods

scope()

scope(\Cake\ORM\Query $query, \Search\Token $token) : \Cake\ORM\Query

Alters the given query and applies this operator's filter conditions.

Parameters

\Cake\ORM\Query $query

The query to alter

\Search\Token $token

Token representing this operator. Frequently used methods are:

  • Token::value(): The value for this operator, that is whatever comes after : symbol. e.g. JohnLocke for criteria author:JohnLocke
  • Token::negated(): True if user has negated this operator using the - symbol. e.g.: -author:JohnLocke. False otherwise.
  • Token::where(): Possible values are "or", "and" and null. Indicates the type of WHERE condition that should be used when scoping using this token, for instance, OR author:JohnLocke will return or. But, AND author:JohnLocke will return and. By default it is set to NULL. This allows you to use Query::andWhere() and Query::orWhere() methods as needed.

Returns

\Cake\ORM\Query —

Altered query

__construct()

__construct(\Cake\ORM\Table $table, array $config)

Operator constructor.

Parameters

\Cake\ORM\Table $table

The table for which handle this operator

array $config

Additional configuration options for this particular operator

_parseRange()

_parseRange(string $value) : array

Parses and extracts lower and upper values from the given range given as `lower.

.upper`.

Parameters

string $value

A values range given as <lowerValue>..<upperValue>. For instance. 100..200

Returns

array —

Associative array with two keys: lower and upper