TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
QueryBuilder Class Reference

Public Member Functions

 __construct (Connection $connection, QueryRestrictionContainerInterface $restrictionContainer=null,\Doctrine\DBAL\Query\QueryBuilder $concreteQueryBuilder=null)
 
 getRestrictions ()
 
 setRestrictions (QueryRestrictionContainerInterface $restrictionContainer)
 
 resetRestrictions ()
 
 expr ()
 
 getType ()
 
 getConnection ()
 
 getState ()
 
 getConcreteQueryBuilder ()
 
 execute ()
 
 getSQL ()
 
 setParameter ($key, $value, string $type=null)
 
 setParameters (array $params, array $types=[])
 
 getParameters ()
 
 getParameter ($key)
 
 getParameterTypes ()
 
 getParameterType ($key)
 
 setFirstResult (int $firstResult)
 
 getFirstResult ()
 
 setMaxResults (int $maxResults)
 
 getMaxResults ()
 
 add (string $sqlPartName, string $sqlPart, bool $append=false)
 
 count (string $item)
 
 select (string...$selects)
 
 addSelect (string...$selects)
 
 selectLiteral (string...$selects)
 
 addSelectLiteral (string...$selects)
 
 delete (string $delete, string $alias=null)
 
 update (string $update, string $alias=null)
 
 insert (string $insert)
 
 from (string $from, string $alias=null)
 
 join (string $fromAlias, string $join, string $alias, string $condition=null)
 
 innerJoin (string $fromAlias, string $join, string $alias, string $condition=null)
 
 leftJoin (string $fromAlias, string $join, string $alias, string $condition=null)
 
 rightJoin (string $fromAlias, string $join, string $alias, string $condition=null)
 
 set (string $key, $value, bool $createNamedParameter=true)
 
 where (...$predicates)
 
 andWhere (...$where)
 
 orWhere (...$where)
 
 groupBy (...$groupBy)
 
 addGroupBy (...$groupBy)
 
 setValue (string $column, $value, bool $createNamedParameter=true)
 
 values (array $values, bool $createNamedParameters=true)
 
 having (...$having)
 
 andHaving (...$having)
 
 orHaving (...$having)
 
 orderBy (string $fieldName, string $order=null)
 
 addOrderBy (string $fieldName, string $order=null)
 
 getQueryPart (string $queryPartName)
 
 getQueryParts ()
 
 resetQueryParts (array $queryPartNames=null)
 
 resetQueryPart ($queryPartName)
 
 __toString ()
 
 createNamedParameter ($value, int $type=\PDO::PARAM_STR, string $placeHolder=null)
 
 createPositionalParameter ($value, int $type=\PDO::PARAM_STR)
 
 escapeLikeWildcards (string $value)
 
 quote ($input, string $type=null)
 
 quoteIdentifier (string $identifier)
 
 quoteIdentifiers (array $input)
 
 quoteIdentifiersForSelect (array $input)
 
 quoteColumnValuePairs (array $input)
 

Protected Member Functions

 unquoteSingleIdentifier (string $identifier)
 
 getQueriedTables ()
 
 addAdditionalWhereConditions ()
 

Protected Attributes

 $connection
 
 $concreteQueryBuilder
 
 $restrictionContainer
 

Detailed Description

Object oriented approach to building SQL queries.

It's a facade to the Doctrine DBAL QueryBuilder that implements PHP7 type hinting and automatic quoting of table and column names.

$query->select('aField', 'anotherField') ->from('aTable') ->where($query->expr()->eq('aField', 1)) ->andWhere($query->expr()->gte('anotherField',10')) ->execute()

Additional functionality included is support for COUNT() and TRUNCATE() statements.

Definition at line 41 of file QueryBuilder.php.

Constructor & Destructor Documentation

__construct ( Connection  $connection,
QueryRestrictionContainerInterface  $restrictionContainer = null,
\Doctrine\DBAL\Query\QueryBuilder  $concreteQueryBuilder = null 
)

Initializes a new QueryBuilder.

Parameters
Connection$connectionThe DBAL Connection.
QueryRestrictionContainerInterface$restrictionContainer
\Doctrine\DBAL\Query\QueryBuilder$concreteQueryBuilder

Definition at line 67 of file QueryBuilder.php.

References QueryBuilder\$concreteQueryBuilder, QueryBuilder\$connection, QueryBuilder\$restrictionContainer, and GeneralUtility\makeInstance().

Member Function Documentation

__toString ( )

Gets a string representation of this QueryBuilder which corresponds to the final SQL query being constructed.

Returns
string The string representation of this QueryBuilder.

Definition at line 857 of file QueryBuilder.php.

References QueryBuilder\getSQL().

add ( string  $sqlPartName,
string  $sqlPart,
bool  $append = false 
)

Either appends to or replaces a single, generic query part.

The available parts are: 'select', 'from', 'set', 'where', 'groupBy', 'having' and 'orderBy'.

Parameters
string$sqlPartName
string$sqlPart
bool$append
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 344 of file QueryBuilder.php.

References QueryBuilder\add().

Referenced by QueryBuilder\add().

addAdditionalWhereConditions ( )
protected

Add the additional query conditions returned by the QueryRestrictionBuilder to the current query and return the original set of conditions so that they can be restored after the query has been built/executed.

Returns
|mixed

Definition at line 1068 of file QueryBuilder.php.

References QueryBuilder\expr(), and QueryBuilder\getQueriedTables().

Referenced by QueryBuilder\execute(), and QueryBuilder\getSQL().

addGroupBy (   $groupBy)

Adds a grouping expression to the query.

Parameters
mixed,...$groupBy The grouping expression.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 678 of file QueryBuilder.php.

References QueryBuilder\addGroupBy(), and QueryBuilder\quoteIdentifiers().

Referenced by QueryBuilder\addGroupBy().

addOrderBy ( string  $fieldName,
string  $order = null 
)

Adds an ordering to the query results.

Parameters
string$fieldNameThe fieldName to order by. Will be quoted according to database platform automatically.
string$orderThe ordering direction.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 794 of file QueryBuilder.php.

References QueryBuilder\addOrderBy().

Referenced by QueryBuilder\addOrderBy().

addSelect ( string...  $selects)

Adds an item that is to be returned in the query result.

Parameters
string[]$selects The selection expression.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 389 of file QueryBuilder.php.

References QueryBuilder\addSelect(), and QueryBuilder\quoteIdentifiersForSelect().

Referenced by QueryBuilder\addSelect(), and QueryBuilder\addSelectLiteral().

addSelectLiteral ( string...  $selects)

Adds an item that is to be returned in the query result. This should only be used for literal SQL expressions as no quoting/escaping of any kind will be performed on the items.

Parameters
string[]$selects Literal SQL expressions to be selected.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 420 of file QueryBuilder.php.

References QueryBuilder\addSelect().

andHaving (   $having)

Adds a restriction over the groups of the query, forming a logical conjunction with any existing having restrictions.

Parameters
mixed,...$having The restriction to append.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 748 of file QueryBuilder.php.

References QueryBuilder\andHaving().

Referenced by QueryBuilder\andHaving().

andWhere (   $where)

Adds one or more restrictions to the query results, forming a logical conjunction with any previously specified restrictions.

Parameters
mixed,...$where The query restrictions.
Returns
QueryBuilder This QueryBuilder instance.
See also
where()

Definition at line 632 of file QueryBuilder.php.

References QueryBuilder\andWhere().

Referenced by QueryBuilder\andWhere(), and DataProvider\setWhereClause().

count ( string  $item)

Specifies the item that is to be counted in the query result. Replaces any previously specified selections, if any.

Parameters
string$itemWill be quoted according to database platform automatically.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 358 of file QueryBuilder.php.

References QueryBuilder\getConnection(), and QueryBuilder\quoteIdentifier().

createNamedParameter (   $value,
int  $type = \PDO::PARAM_STR,
string  $placeHolder = null 
)

Creates a new named parameter and bind the value $value to it.

This method provides a shortcut for PDOStatement::bindValue when using prepared statements.

The parameter $value specifies the value that you want to bind. If $placeholder is not provided bindValue() will automatically create a placeholder for you. An automatic placeholder will be of the name ':dcValue1', ':dcValue2' etc.

Parameters
mixed$value
int$type
string$placeHolderThe name to bind with. The string must start with a colon ':'.
Returns
string the placeholder name used.

Definition at line 879 of file QueryBuilder.php.

Referenced by LiveSearch\makeQuerySearchByTable(), QueryBuilder\set(), QueryBuilder\setValue(), DataProvider\setWhereClause(), and QueryBuilder\values().

createPositionalParameter (   $value,
int  $type = \PDO::PARAM_STR 
)

Creates a new positional parameter and bind the given value to it.

Attention: If you are using positional parameters with the query builder you have to be very careful to bind all parameters in the order they appear in the SQL statement , otherwise they get bound in the wrong order which can lead to serious bugs in your code.

Parameters
mixed$value
int$type
Returns
string

Definition at line 897 of file QueryBuilder.php.

delete ( string  $delete,
string  $alias = null 
)

Turns the query being built into a bulk delete query that ranges over a certain table.

Parameters
string$deleteThe table whose rows are subject to the deletion. Will be quoted according to database platform automatically.
string$aliasThe table alias used in the constructed query. Will be quoted according to database platform automatically.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 438 of file QueryBuilder.php.

References QueryBuilder\delete(), and QueryBuilder\quoteIdentifier().

Referenced by QueryBuilder\delete().

escapeLikeWildcards ( string  $value)

Quotes like wildcards for given string value.

Parameters
string$valueThe value to be quoted.
Returns
string The quoted value.

Definition at line 909 of file QueryBuilder.php.

Referenced by LiveSearch\makeQuerySearchByTable(), and DataProvider\setWhereClause().

execute ( )

Executes this query using the bound parameters and their types.

Returns
|int

Definition at line 163 of file QueryBuilder.php.

References QueryBuilder\addAdditionalWhereConditions(), and QueryBuilder\getType().

expr ( )

Gets an ExpressionBuilder used for object-oriented construction of query expressions. This producer method is intended for convenient inline usage. Example:

For more complex expression construction, consider storing the expression builder object in a local variable.

Returns
ExpressionBuilder

Definition at line 110 of file QueryBuilder.php.

Referenced by QueryBuilder\addAdditionalWhereConditions(), LiveSearch\makeQuerySearchByTable(), and DataProvider\setWhereClause().

from ( string  $from,
string  $alias = null 
)

Creates and adds a query root corresponding to the table identified by the given alias, forming a cartesian product with any existing query roots.

Parameters
string$fromThe table. Will be quoted according to database platform automatically.
string$aliasThe alias of the table. Will be quoted according to database platform automatically.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 491 of file QueryBuilder.php.

References QueryBuilder\from(), and QueryBuilder\quoteIdentifier().

Referenced by QueryBuilder\from().

getConcreteQueryBuilder ( )

Gets the concrete implementation of the query builder

Returns

Definition at line 153 of file QueryBuilder.php.

References QueryBuilder\$concreteQueryBuilder.

getFirstResult ( )

Gets the position of the first result the query object was set to retrieve (the "offset"). Returns NULL if setFirstResult was not applied to this QueryBuilder.

Returns
int The position of the first result.

Definition at line 302 of file QueryBuilder.php.

Referenced by ContentObjectRenderer\getQueryArray().

getMaxResults ( )

Gets the maximum number of results the query object was set to retrieve (the "limit"). Returns 0 if setMaxResults was not applied to this query builder.

Returns
int The maximum number of results.

Definition at line 327 of file QueryBuilder.php.

Referenced by ContentObjectRenderer\getQueryArray().

getParameter (   $key)

Gets a (previously set) query parameter of the query being constructed.

Parameters
string | int$keyThe key (index or name) of the bound parameter.
Returns
mixed The value of the bound parameter.

Definition at line 255 of file QueryBuilder.php.

getParameters ( )

Gets all defined query parameters for the query being constructed indexed by parameter index or name.

Returns
array The currently defined query parameters indexed by parameter index or name.

Definition at line 243 of file QueryBuilder.php.

getParameterType (   $key)

Gets a (previously set) query parameter type of the query being constructed.

Parameters
string | int$keyThe key (index or name) of the bound parameter type.
Returns
mixed The value of the bound parameter type.

Definition at line 277 of file QueryBuilder.php.

getParameterTypes ( )

Gets all defined query parameter types for the query being constructed indexed by parameter index or name.

Returns
array The currently defined query parameter types indexed by parameter index or name.

Definition at line 265 of file QueryBuilder.php.

getQueriedTables ( )
protected

Return all tables/aliases used in FROM or JOIN query parts from the query builder.

The table names are automatically unquoted. This is a helper for to build the list of queried tables for the QueryRestrictionBuilder.

Returns
string[]

Definition at line 1038 of file QueryBuilder.php.

References QueryBuilder\getQueryPart(), and QueryBuilder\unquoteSingleIdentifier().

Referenced by QueryBuilder\addAdditionalWhereConditions().

getQueryPart ( string  $queryPartName)

Gets a query part by its name.

Parameters
string$queryPartName
Returns
mixed

Definition at line 808 of file QueryBuilder.php.

Referenced by QueryBuilder\getQueriedTables(), and ContentObjectRenderer\getQueryArray().

getQueryParts ( )

Gets all query parts.

Returns
array

Definition at line 818 of file QueryBuilder.php.

getRestrictions ( )
Returns
QueryRestrictionContainerInterface

Definition at line 80 of file QueryBuilder.php.

References QueryBuilder\$restrictionContainer.

getSQL ( )

Gets the complete SQL string formed by the current specifications of this QueryBuilder.

If the statement is a SELECT TYPE query restrictions based on TCA settings will automatically be applied based on the current QuerySettings.

Returns
string The SQL query string.

Definition at line 189 of file QueryBuilder.php.

References QueryBuilder\addAdditionalWhereConditions(), and QueryBuilder\getType().

Referenced by QueryBuilder\__toString().

getState ( )

Gets the state of this query builder instance.

Returns
int Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.

Definition at line 142 of file QueryBuilder.php.

getType ( )

Gets the type of the currently built query.

Returns
int

Definition at line 121 of file QueryBuilder.php.

Referenced by QueryBuilder\execute(), and QueryBuilder\getSQL().

groupBy (   $groupBy)

Specifies a grouping over the results of the query. Replaces any previously specified groupings, if any.

Parameters
mixed,...$groupBy The grouping expression.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 664 of file QueryBuilder.php.

References QueryBuilder\groupBy(), and QueryBuilder\quoteIdentifiers().

Referenced by QueryBuilder\groupBy().

having (   $having)

Specifies a restriction over the groups of the query. Replaces any previous having restrictions, if any.

Parameters
mixed,...$having The restriction over the groups.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 734 of file QueryBuilder.php.

References QueryBuilder\having().

Referenced by QueryBuilder\having().

innerJoin ( string  $fromAlias,
string  $join,
string  $alias,
string  $condition = null 
)

Creates and adds a join to the query.

Parameters
string$fromAliasThe alias that points to a from clause.
string$joinThe table name to join.
string$aliasThe alias of the join table.
string$conditionThe condition for the join.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 533 of file QueryBuilder.php.

References QueryBuilder\innerJoin(), and QueryBuilder\quoteIdentifier().

Referenced by QueryBuilder\innerJoin(), and QueryBuilder\join().

insert ( string  $insert)

Turns the query being built into an insert query that inserts into a certain table

Parameters
string$insertThe table into which the rows should be inserted.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 475 of file QueryBuilder.php.

References QueryBuilder\insert(), and QueryBuilder\quoteIdentifier().

Referenced by QueryBuilder\insert().

join ( string  $fromAlias,
string  $join,
string  $alias,
string  $condition = null 
)

Creates and adds a join to the query.

Parameters
string$fromAliasThe alias that points to a from clause.
string$joinThe table name to join.
string$aliasThe alias of the join table.
string$conditionThe condition for the join.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 511 of file QueryBuilder.php.

References QueryBuilder\innerJoin(), and QueryBuilder\quoteIdentifier().

leftJoin ( string  $fromAlias,
string  $join,
string  $alias,
string  $condition = null 
)

Creates and adds a left join to the query.

Parameters
string$fromAliasThe alias that points to a from clause.
string$joinThe table name to join.
string$aliasThe alias of the join table.
string$conditionThe condition for the join.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 555 of file QueryBuilder.php.

References QueryBuilder\leftJoin(), and QueryBuilder\quoteIdentifier().

Referenced by QueryBuilder\leftJoin().

orderBy ( string  $fieldName,
string  $order = null 
)

Specifies an ordering for the query results. Replaces any previously specified orderings, if any.

Parameters
string$fieldNameThe fieldName to order by. Will be quoted according to database platform automatically.
string$orderThe ordering direction. No automatic quoting/escaping.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 779 of file QueryBuilder.php.

References QueryBuilder\orderBy().

Referenced by QueryBuilder\orderBy().

orHaving (   $having)

Adds a restriction over the groups of the query, forming a logical disjunction with any existing having restrictions.

Parameters
mixed,...$having The restriction to add.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 763 of file QueryBuilder.php.

References QueryBuilder\orHaving().

Referenced by QueryBuilder\orHaving().

orWhere (   $where)

Adds one or more restrictions to the query results, forming a logical disjunction with any previously specified restrictions.

Parameters
mixed,...$where The WHERE statement.
Returns
QueryBuilder This QueryBuilder instance.
See also
where()

Definition at line 649 of file QueryBuilder.php.

References QueryBuilder\orWhere().

Referenced by QueryBuilder\orWhere().

quote (   $input,
string  $type = null 
)

Quotes a given input parameter.

Parameters
mixed$inputThe parameter to be quoted.
string | null$typeThe type of the parameter.
Returns
string The quoted parameter.

Definition at line 922 of file QueryBuilder.php.

References QueryBuilder\getConnection().

quoteColumnValuePairs ( array  $input)

Quotes an associative array of column-value so the column names can be safely used, even if the name is a reserved name.

Delimiting style depends on the underlying database platform that is being used.

Parameters
array$input
Returns
array

Definition at line 1007 of file QueryBuilder.php.

References QueryBuilder\getConnection().

Referenced by QueryBuilder\values().

quoteIdentifier ( string  $identifier)

Quotes a string so it can be safely used as a table or column name, even if it is a reserved name.

Delimiting style depends on the underlying database platform that is being used.

Parameters
string$identifierThe name to be quoted.
Returns
string The quoted name.

Definition at line 937 of file QueryBuilder.php.

References QueryBuilder\getConnection().

Referenced by QueryBuilder\count(), QueryBuilder\delete(), QueryBuilder\from(), QueryBuilder\innerJoin(), QueryBuilder\insert(), QueryBuilder\join(), QueryBuilder\leftJoin(), LiveSearch\makeQuerySearchByTable(), QueryBuilder\quoteIdentifiersForSelect(), QueryBuilder\rightJoin(), QueryBuilder\set(), QueryBuilder\setValue(), and QueryBuilder\update().

quoteIdentifiers ( array  $input)

Quotes an array of column names so it can be safely used, even if the name is a reserved name.

Delimiting style depends on the underlying database platform that is being used.

Parameters
array$input
Returns
array

Definition at line 951 of file QueryBuilder.php.

References QueryBuilder\getConnection().

Referenced by QueryBuilder\addGroupBy(), and QueryBuilder\groupBy().

quoteIdentifiersForSelect ( array  $input)

Quotes an array of column names so it can be safely used, even if the name is a reserved name. Takes into account the special case of the * placeholder that can only be used in SELECT type statements.

Delimiting style depends on the underlying database platform that is being used.

Parameters
array$input
Returns
array
Exceptions
InvalidArgumentException

Definition at line 968 of file QueryBuilder.php.

References QueryBuilder\quoteIdentifier(), and GeneralUtility\trimExplode().

Referenced by QueryBuilder\addSelect(), and QueryBuilder\select().

resetQueryPart (   $queryPartName)

Resets a single SQL part.

Parameters
string$queryPartName
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 844 of file QueryBuilder.php.

References QueryBuilder\resetQueryPart().

Referenced by QueryBuilder\resetQueryPart().

resetQueryParts ( array  $queryPartNames = null)

Resets SQL parts.

Parameters
array | null$queryPartNames
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 830 of file QueryBuilder.php.

References QueryBuilder\resetQueryParts().

Referenced by QueryBuilder\resetQueryParts().

resetRestrictions ( )

Re-apply default restrictions

Definition at line 96 of file QueryBuilder.php.

References GeneralUtility\makeInstance().

rightJoin ( string  $fromAlias,
string  $join,
string  $alias,
string  $condition = null 
)

Creates and adds a right join to the query.

Parameters
string$fromAliasThe alias that points to a from clause.
string$joinThe table name to join.
string$aliasThe alias of the join table.
string$conditionThe condition for the join.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 577 of file QueryBuilder.php.

References QueryBuilder\quoteIdentifier(), and QueryBuilder\rightJoin().

Referenced by QueryBuilder\rightJoin().

select ( string...  $selects)

Specifies items that are to be returned in the query result. Replaces any previously specified selections, if any.

Parameters
string[]$selects
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 375 of file QueryBuilder.php.

References QueryBuilder\quoteIdentifiersForSelect(), and QueryBuilder\select().

Referenced by QueryBuilder\select(), and QueryBuilder\selectLiteral().

selectLiteral ( string...  $selects)

Specifies items that are to be returned in the query result. Replaces any previously specified selections, if any. This should only be used for literal SQL expressions as no quoting/escaping of any kind will be performed on the items.

Parameters
string[]$selects Literal SQL expressions to be selected. Warning: No quoting will be done!
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 405 of file QueryBuilder.php.

References QueryBuilder\select().

set ( string  $key,
  $value,
bool  $createNamedParameter = true 
)

Sets a new value for a column in a bulk update query.

Parameters
string$keyThe column to set.
string$valueThe value, expression, placeholder, etc.
bool$createNamedParameterAutomatically create a named parameter for the value
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 598 of file QueryBuilder.php.

References QueryBuilder\createNamedParameter(), QueryBuilder\quoteIdentifier(), and QueryBuilder\set().

Referenced by QueryBuilder\set().

setFirstResult ( int  $firstResult)

Sets the position of the first result to retrieve (the "offset").

Parameters
int$firstResultThe first result to return.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 289 of file QueryBuilder.php.

References QueryBuilder\setFirstResult().

Referenced by QueryBuilder\setFirstResult().

setMaxResults ( int  $maxResults)

Sets the maximum number of results to retrieve (the "limit").

Parameters
int$maxResultsThe maximum number of results to retrieve.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 314 of file QueryBuilder.php.

References QueryBuilder\setMaxResults().

Referenced by QueryBuilder\setMaxResults().

setParameter (   $key,
  $value,
string  $type = null 
)

Sets a query parameter for the query being constructed.

Parameters
string | int$keyThe parameter position or name.
mixed$valueThe parameter value.
string | null$typeOne of the Connection::PARAM_* constants.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 216 of file QueryBuilder.php.

References QueryBuilder\setParameter().

Referenced by QueryBuilder\setParameter().

setParameters ( array  $params,
array  $types = [] 
)

Sets a collection of query parameters for the query being constructed.

Parameters
array$paramsThe query parameters to set.
array$typesThe query parameters types to set.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 231 of file QueryBuilder.php.

References QueryBuilder\setParameters().

Referenced by QueryBuilder\setParameters().

setRestrictions ( QueryRestrictionContainerInterface  $restrictionContainer)
Parameters
QueryRestrictionContainerInterface$restrictionContainer

Definition at line 88 of file QueryBuilder.php.

References QueryBuilder\$restrictionContainer.

setValue ( string  $column,
  $value,
bool  $createNamedParameter = true 
)

Sets a value for a column in an insert query.

Parameters
string$columnThe column into which the value should be inserted.
string$valueThe value that should be inserted into the column.
bool$createNamedParameterAutomatically create a named parameter for the value
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 694 of file QueryBuilder.php.

References QueryBuilder\createNamedParameter(), QueryBuilder\quoteIdentifier(), and QueryBuilder\setValue().

Referenced by QueryBuilder\setValue().

unquoteSingleIdentifier ( string  $identifier)
protected

Unquote a single identifier (no dot expansion). Used to unquote the table names from the expressionBuilder so that the table can be found in the TCA definition.

Parameters
string$identifierThe identifier / table name
Returns
string The unquoted table name / identifier

Definition at line 1019 of file QueryBuilder.php.

References QueryBuilder\getConnection().

Referenced by QueryBuilder\getQueriedTables().

update ( string  $update,
string  $alias = null 
)

Turns the query being built into a bulk update query that ranges over a certain table

Parameters
string$updateThe table whose rows are subject to the update.
string$aliasThe table alias used in the constructed query.
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 457 of file QueryBuilder.php.

References QueryBuilder\quoteIdentifier(), and QueryBuilder\update().

Referenced by QueryBuilder\update().

values ( array  $values,
bool  $createNamedParameters = true 
)

Specifies values for an insert query indexed by column names. Replaces any previous values, if any.

Parameters
array$valuesThe values to specify for the insert query indexed by column names.
bool$createNamedParametersAutomatically create named parameters for all values
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 713 of file QueryBuilder.php.

References QueryBuilder\createNamedParameter(), and QueryBuilder\quoteColumnValuePairs().

where (   $predicates)

Specifies one or more restrictions to the query result. Replaces any previously specified restrictions, if any.

Parameters
mixed,...$predicates
Returns
QueryBuilder This QueryBuilder instance.

Definition at line 615 of file QueryBuilder.php.

References QueryBuilder\where().

Referenced by DataProvider\setWhereClause(), and QueryBuilder\where().

Member Data Documentation

$concreteQueryBuilder
protected
$connection
protected

Definition at line 48 of file QueryBuilder.php.

Referenced by QueryBuilder\__construct(), and QueryBuilder\getConnection().

$restrictionContainer
protected