PHP Класс Bolt\Storage\Query\QueryParameterParser

@author Ross Riley
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$alias string

Защищенные свойства (Protected)

Свойство Тип Описание
$expr Doctrine\DBAL\Query\Expression\ExpressionBuilder
$filterHandlers Filter[]
$key string
$value mixed
$valueMatchers array

Открытые методы

Метод Описание
__construct ( Doctrine\DBAL\Query\Expression\ExpressionBuilder $expr = null ) Constructor.
addFilterHandler ( callable $handler ) The goal of this class is to turn any key:value into a Filter class.
addValueMatcher ( string $token, array $params = [], boolean $priority = null ) Adds an additional token to parse for value parameters.
defaultFilterHandler ( string $key, string $value, Doctrine\DBAL\Query\Expression\ExpressionBuilder $expr ) : Filter The default handler is the last to be run and handler simple value parsing.
getFilter ( string $key, mixed $value = null ) : Filter | null Runs the keys/values through the relevant parsers.
incorrectQueryHandler ( string $key, string $value, Doctrine\DBAL\Query\Expression\ExpressionBuilder $expr ) Handles some errors in key/value string formatting.
multipleKeyAndValueHandler ( string $key, string $value, Doctrine\DBAL\Query\Expression\ExpressionBuilder $expr ) : Filter | null This handler processes 'triple pipe' queries as implemented in Bolt It looks for three pipes in the key and value and creates an OR composite expression for example: 'username|||email':'fred|||pete'.
multipleValueHandler ( string $key, string $value, Doctrine\DBAL\Query\Expression\ExpressionBuilder $expr ) : Filter | null This handler processes multiple value queries as defined in the Bolt 'Fetching Content' documentation. It allows a value to be parsed to and AND/OR expression.
parseValue ( string $value ) : array This method uses the defined value matchers to parse a passed in value to the following component parts: [ 'value' => 'operator' => 'matched' => ]
setAlias ( string $alias ) Sets the select alias to be used in sql queries.
setupDefaults ( )

Описание методов

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

Constructor.
public __construct ( Doctrine\DBAL\Query\Expression\ExpressionBuilder $expr = null )
$expr Doctrine\DBAL\Query\Expression\ExpressionBuilder

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

Adding a handler here will push the new filter callback onto the top of the Queue along with the built in defaults. Note: the callback should either return nothing or an instance of \Bolt\Storage\Query\Filter
public addFilterHandler ( callable $handler )
$handler callable

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

This gives the ability to define additional value -> operator matches
public addValueMatcher ( string $token, array $params = [], boolean $priority = null )
$token string Regex pattern to match against
$params array Options to provide to the matched param
$priority boolean If set item will be prepended to start of list

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

The default handler is the last to be run and handler simple value parsing.
public defaultFilterHandler ( string $key, string $value, Doctrine\DBAL\Query\Expression\ExpressionBuilder $expr ) : Filter
$key string
$value string
$expr Doctrine\DBAL\Query\Expression\ExpressionBuilder
Результат Filter

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

Runs the keys/values through the relevant parsers.
public getFilter ( string $key, mixed $value = null ) : Filter | null
$key string
$value mixed
Результат Filter | null

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

Handles some errors in key/value string formatting.
public incorrectQueryHandler ( string $key, string $value, Doctrine\DBAL\Query\Expression\ExpressionBuilder $expr )
$key string
$value string
$expr Doctrine\DBAL\Query\Expression\ExpressionBuilder

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

This handler processes 'triple pipe' queries as implemented in Bolt It looks for three pipes in the key and value and creates an OR composite expression for example: 'username|||email':'fred|||pete'.
public multipleKeyAndValueHandler ( string $key, string $value, Doctrine\DBAL\Query\Expression\ExpressionBuilder $expr ) : Filter | null
$key string
$value string
$expr Doctrine\DBAL\Query\Expression\ExpressionBuilder
Результат Filter | null

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

For example, this handler will correctly parse values like: 'username': 'fred||bob' 'id': '<5 && !1'
public multipleValueHandler ( string $key, string $value, Doctrine\DBAL\Query\Expression\ExpressionBuilder $expr ) : Filter | null
$key string
$value string
$expr Doctrine\DBAL\Query\Expression\ExpressionBuilder
Результат Filter | null

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

This method uses the defined value matchers to parse a passed in value to the following component parts: [ 'value' => 'operator' => 'matched' => ]
public parseValue ( string $value ) : array
$value string Value to process
Результат array Parsed values

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

Sets the select alias to be used in sql queries.
public setAlias ( string $alias )
$alias string

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

public setupDefaults ( )

Описание свойств

$alias публичное свойство

public string $alias
Результат string

$expr защищенное свойство

protected ExpressionBuilder,Doctrine\DBAL\Query\Expression $expr
Результат Doctrine\DBAL\Query\Expression\ExpressionBuilder

$filterHandlers защищенное свойство

protected Filter[],Bolt\Storage\Query $filterHandlers
Результат Filter[]

$key защищенное свойство

protected string $key
Результат string

$value защищенное свойство

protected mixed $value
Результат mixed

$valueMatchers защищенное свойство

protected array $valueMatchers
Результат array