PHP Class Bolt\Storage\Query\SelectQuery

@link https://docs.bolt.cm/templates/content-fetching The resulting QueryBuilder object is then passed through to the individual field handlers where they can perform value transformations.
Author: Ross Riley ([email protected])
Inheritance: implements Bolt\Storage\Query\QueryInterface
Mostra file Open project: bolt/bolt Class Usage Examples

Protected Properties

Property Type Description
$contentType string
$filters Filter[]
$params array
$parser QueryParameterParser
$qb Doctrine\DBAL\Query\QueryBuilder
$replacements
$singleFetchMode boolean

Public Methods

Method Description
__construct ( Doctrine\DBAL\Query\QueryBuilder $qb, QueryParameterParser $parser ) Constructor.
__toString ( ) : string
addFilter ( Filter $filter )
build ( ) : Doctrine\DBAL\Query\QueryBuilder Part of the QueryInterface this turns all the input into a Doctrine QueryBuilder object and is usually run just before query execution.
getContentType ( ) : string Gets the ContentType that this query will run against.
getFilters ( ) : Filter[] Returns all the filters attached to the query
getQueryBuilder ( ) : Doctrine\DBAL\Query\QueryBuilder Allows public access to the QueryBuilder object
getSingleFetchMode ( ) : boolean Returns whether the query is in single fetch mode.
getWhereExpression ( ) : CompositeExpression Creates a composite expression that adds all the attached filters individual expressions into a combined one.
getWhereParameters ( ) : array Returns all the parameters for the query.
getWhereParametersFor ( string $fieldName ) : array Gets all the parameters for a specific field name.
setContentType ( string $contentType ) Sets the ContentType that this query will run against.
setParameters ( array $params ) Sets the parameters that will filter / alter the query
setQueryBuilder ( Doctrine\DBAL\Query\QueryBuilder $qb ) Allows replacing the default QueryBuilder.
setSingleFetchMode ( boolean $value ) Turns single fetch mode on or off.
setWhereParameter ( string $key, mixed $value ) Sets all the parameters for a specific field name.

Protected Methods

Method Description
processFilters ( ) Internal method that runs the individual key/value input through the QueryParameterParser. This allows complicated expressions to be turned into simple sql expressions

Method Details

__construct() public method

Constructor.
public __construct ( Doctrine\DBAL\Query\QueryBuilder $qb, QueryParameterParser $parser )
$qb Doctrine\DBAL\Query\QueryBuilder
$parser QueryParameterParser

__toString() public method

public __toString ( ) : string
return string String representation of query

addFilter() public method

public addFilter ( Filter $filter )
$filter Filter

build() public method

That allows modifications to be made to any of the parameters up until query execution time.
public build ( ) : Doctrine\DBAL\Query\QueryBuilder
return Doctrine\DBAL\Query\QueryBuilder

getContentType() public method

Gets the ContentType that this query will run against.
public getContentType ( ) : string
return string

getFilters() public method

Returns all the filters attached to the query
public getFilters ( ) : Filter[]
return Filter[]

getQueryBuilder() public method

Allows public access to the QueryBuilder object
public getQueryBuilder ( ) : Doctrine\DBAL\Query\QueryBuilder
return Doctrine\DBAL\Query\QueryBuilder

getSingleFetchMode() public method

Returns whether the query is in single fetch mode.
public getSingleFetchMode ( ) : boolean
return boolean

getWhereExpression() public method

Creates a composite expression that adds all the attached filters individual expressions into a combined one.
public getWhereExpression ( ) : CompositeExpression
return Doctrine\DBAL\Query\Expression\CompositeExpression

getWhereParameters() public method

Returns all the parameters for the query.
public getWhereParameters ( ) : array
return array

getWhereParametersFor() public method

Gets all the parameters for a specific field name.
public getWhereParametersFor ( string $fieldName ) : array
$fieldName string
return array array of key=>value parameters

processFilters() protected method

Internal method that runs the individual key/value input through the QueryParameterParser. This allows complicated expressions to be turned into simple sql expressions
protected processFilters ( )

setContentType() public method

Sets the ContentType that this query will run against.
public setContentType ( string $contentType )
$contentType string

setParameters() public method

Sets the parameters that will filter / alter the query
public setParameters ( array $params )
$params array

setQueryBuilder() public method

Allows replacing the default QueryBuilder.
public setQueryBuilder ( Doctrine\DBAL\Query\QueryBuilder $qb )
$qb Doctrine\DBAL\Query\QueryBuilder

setSingleFetchMode() public method

Turns single fetch mode on or off.
public setSingleFetchMode ( boolean $value )
$value boolean

setWhereParameter() public method

Sets all the parameters for a specific field name.
public setWhereParameter ( string $key, mixed $value )
$key string
$value mixed

Property Details

$contentType protected_oe property

protected string $contentType
return string

$filters protected_oe property

protected Filter[],Bolt\Storage\Query $filters
return Filter[]

$params protected_oe property

protected array $params
return array

$parser protected_oe property

protected QueryParameterParser,Bolt\Storage\Query $parser
return QueryParameterParser

$qb protected_oe property

protected QueryBuilder,Doctrine\DBAL\Query $qb
return Doctrine\DBAL\Query\QueryBuilder

$replacements protected_oe property

protected $replacements

$singleFetchMode protected_oe property

protected bool $singleFetchMode
return boolean