PHP Class Bolt\Storage\Query\ContentQueryParser

@author Ross Riley
Afficher le fichier Open project: bolt/bolt Class Usage Examples

Protected Properties

Свойство Type Description
$contentTypes array
$directiveHandlers callable[]
$directives array
$em Bolt\Storage\EntityManager
$handlers callable[]
$identifier string
$operation string
$operations array
$params array
$query string
$services Bolt\Storage\Query\QueryInterface[]

Méthodes publiques

Méthode Description
__construct ( EntityManager $em, Bolt\Storage\Query\QueryInterface $queryHandler = null ) Constructor.
addDirectiveHandler ( string $key, callable $callback = null ) Adds a handler for the named directive.
addHandler ( string $operation, callable $callback ) Adds a handler AND operation for the named operation.
addOperation ( string $operation ) Adds a new operation to the list supported.
addService ( string $operation, Bolt\Storage\Query\QueryInterface $service ) Adds a service for the named operation.
fetch ( ) : QueryResultset Runs the query and fetches the results.
getContentTypes ( ) : array Returns the parsed content types.
getDirective ( string $key ) : string Returns a directive from the parsed list.
getDirectiveHandler ( string $check ) : callable Returns the handler for the named directive.
getEntityManager ( ) : EntityManager Gets the object EntityManager
getHandler ( string $operation ) : callable Returns a handler for the named operation.
getIdentifier ( ) : string Returns the parsed identifier.
getOperation ( ) : string Returns the parsed operation.
getOperations ( ) : array Getter to return the currently registered operations.
getParameter ( string $param ) : array Returns a single named parameter.
getParameters ( ) : array Returns the current parameters.
getService ( string $operation ) : Bolt\Storage\Query\QueryInterface Returns a service for the named operation.
hasDirectiveHandler ( string $check ) : boolean Returns boolean for existence of handler.
parse ( ) Parse a query.
removeOperation ( string $operation ) Removes an operation from the list supported.
runDirectives ( Bolt\Storage\Query\QueryInterface $query, array $skipDirective = [] ) This runs the callbacks attached to each directive command.
setDirective ( string $key, mixed $value ) Sets a directive for the named key.
setParameter ( string $param, mixed $value ) Sets a single input parameter.
setParameters ( array $params ) Sets the input parameters to handle.
setQuery ( string $query ) Sets the input query.

Méthodes protégées

Méthode Description
parseContent ( ) Parses the content area of the querystring.
parseDirectives ( ) Directives are all of the other parameters supported by Bolt that do not relate to an actual filter query. Some examples include 'printquery', 'limit', 'order' or 'returnsingle'.
parseOperation ( ) Internal method that takes the 'query' part of the input and parses it into one of the various operations supported.
setupDefaults ( ) Internal method to initialise the default handlers.

Method Details

__construct() public méthode

Constructor.
public __construct ( EntityManager $em, Bolt\Storage\Query\QueryInterface $queryHandler = null )
$em Bolt\Storage\EntityManager
$queryHandler Bolt\Storage\Query\QueryInterface

addDirectiveHandler() public méthode

Adds a handler for the named directive.
public addDirectiveHandler ( string $key, callable $callback = null )
$key string
$callback callable

addHandler() public méthode

Adds a handler AND operation for the named operation.
public addHandler ( string $operation, callable $callback )
$operation string
$callback callable

addOperation() public méthode

Adds a new operation to the list supported.
public addOperation ( string $operation )
$operation string name of operation to parse for

addService() public méthode

Adds a service for the named operation.
public addService ( string $operation, Bolt\Storage\Query\QueryInterface $service )
$operation string
$service Bolt\Storage\Query\QueryInterface

fetch() public méthode

Runs the query and fetches the results.
public fetch ( ) : QueryResultset
Résultat QueryResultset

getContentTypes() public méthode

Returns the parsed content types.
public getContentTypes ( ) : array
Résultat array

getDirective() public méthode

Returns a directive from the parsed list.
public getDirective ( string $key ) : string
$key string
Résultat string

getDirectiveHandler() public méthode

Returns the handler for the named directive.
public getDirectiveHandler ( string $check ) : callable
$check string
Résultat callable

getEntityManager() public méthode

Gets the object EntityManager
public getEntityManager ( ) : EntityManager
Résultat Bolt\Storage\EntityManager

getHandler() public méthode

Returns a handler for the named operation.
public getHandler ( string $operation ) : callable
$operation string
Résultat callable

getIdentifier() public méthode

Returns the parsed identifier.
public getIdentifier ( ) : string
Résultat string

getOperation() public méthode

Returns the parsed operation.
public getOperation ( ) : string
Résultat string

getOperations() public méthode

Getter to return the currently registered operations.
public getOperations ( ) : array
Résultat array

getParameter() public méthode

Returns a single named parameter.
public getParameter ( string $param ) : array
$param string
Résultat array

getParameters() public méthode

Returns the current parameters.
public getParameters ( ) : array
Résultat array

getService() public méthode

Returns a service for the named operation.
public getService ( string $operation ) : Bolt\Storage\Query\QueryInterface
$operation string
Résultat Bolt\Storage\Query\QueryInterface

hasDirectiveHandler() public méthode

Returns boolean for existence of handler.
public hasDirectiveHandler ( string $check ) : boolean
$check string
Résultat boolean

parse() public méthode

Parse a query.
public parse ( )

parseContent() protected méthode

Parses the content area of the querystring.
protected parseContent ( )

parseDirectives() protected méthode

All these need to parsed and taken out of the params that are sent to the query.
protected parseDirectives ( )

parseOperation() protected méthode

A simple select operation will just contain the ContentType eg 'pages' but additional operations can be triggered using the '/' separator.
protected parseOperation ( )

removeOperation() public méthode

Removes an operation from the list supported.
public removeOperation ( string $operation )
$operation string name of operation to remove

runDirectives() public méthode

This runs the callbacks attached to each directive command.
public runDirectives ( Bolt\Storage\Query\QueryInterface $query, array $skipDirective = [] )
$query Bolt\Storage\Query\QueryInterface
$skipDirective array

setDirective() public méthode

Sets a directive for the named key.
public setDirective ( string $key, mixed $value )
$key string
$value mixed

setParameter() public méthode

Sets a single input parameter.
public setParameter ( string $param, mixed $value )
$param string
$value mixed

setParameters() public méthode

Sets the input parameters to handle.
public setParameters ( array $params )
$params array

setQuery() public méthode

Sets the input query.
public setQuery ( string $query )
$query string

setupDefaults() protected méthode

Internal method to initialise the default handlers.
protected setupDefaults ( )

Property Details

$contentTypes protected_oe property

protected array $contentTypes
Résultat array

$directiveHandlers protected_oe property

protected callable[] $directiveHandlers
Résultat callable[]

$directives protected_oe property

protected array $directives
Résultat array

$em protected_oe property

protected EntityManager,Bolt\Storage $em
Résultat Bolt\Storage\EntityManager

$handlers protected_oe property

protected callable[] $handlers
Résultat callable[]

$identifier protected_oe property

protected string $identifier
Résultat string

$operation protected_oe property

protected string $operation
Résultat string

$operations protected_oe property

protected array $operations
Résultat array

$params protected_oe property

protected array $params
Résultat array

$query protected_oe property

protected string $query
Résultat string

$services protected_oe property

protected QueryInterface[],Bolt\Storage\Query $services
Résultat Bolt\Storage\Query\QueryInterface[]