Doctrine\ORM\QueryBuilder
This class is responsible for building DQL query strings via an object oriented PHP interface.
- Author: Guilherme Blanco <guilhermeblanco@hotmail.com>
Synopsis
class QueryBuilder
{
- // constants
- const SELECT = 0;
- const DELETE = 1;
- const UPDATE = 2;
- const STATE_DIRTY = 0;
- const STATE_CLEAN = 1;
- // members
- private EntityManager $_em;
- private array $_dqlParts;
- private integer $_type;
- private integer $_state;
- private string $_dql;
- private ArrayCollection $parameters;
- private integer $_firstResult;
- private integer $_maxResults;
- private array $joinRootAliases;
- // methods
- public void __construct()
- public Expr expr()
- public integer getType()
- public EntityManager getEntityManager()
- public integer getState()
- public string getDQL()
- public Query getQuery()
- private string findRootAlias()
- public string getRootAlias()
- public array getRootAliases()
- public array getRootEntities()
- public QueryBuilder setParameter()
- public QueryBuilder setParameters()
- public ArrayCollection getParameters()
- public Parameter|null getParameter()
- public QueryBuilder setFirstResult()
- public integer getFirstResult()
- public QueryBuilder setMaxResults()
- public integer getMaxResults()
- public QueryBuilder add()
- public QueryBuilder select()
- public QueryBuilder distinct()
- public QueryBuilder addSelect()
- public QueryBuilder delete()
- public QueryBuilder update()
- public QueryBuilder from()
- public QueryBuilder join()
- public QueryBuilder innerJoin()
- public QueryBuilder leftJoin()
- public QueryBuilder set()
- public QueryBuilder where()
- public QueryBuilder andWhere()
- public QueryBuilder orWhere()
- public QueryBuilder groupBy()
- public QueryBuilder addGroupBy()
- public QueryBuilder having()
- public QueryBuilder andHaving()
- public QueryBuilder orHaving()
- public QueryBuilder orderBy()
- public QueryBuilder addOrderBy()
- public mixed getDQLPart()
- public array getDQLParts()
- private void _getDQLForDelete()
- private void _getDQLForUpdate()
- private void _getDQLForSelect()
- private void _getReducedDQLQueryPart()
- public QueryBuilder resetDQLParts()
- public QueryBuilder; resetDQLPart()
- public string __toString()
- public void __clone()
Tasks
Line | Task |
---|---|
511 | Remove for 3.0 |
1028+ | Rename: getQueryPart (or remove?) |
1039+ | Rename: getQueryParts (or remove?) |
Constants
Name | Value |
---|---|
SELECT | 0 |
DELETE | 1 |
UPDATE | 2 |
STATE_DIRTY | 0 |
STATE_CLEAN | 1 |
Members
private
- $_dql — string
- $_dqlParts — array
- $_em — Doctrine\ORM\EntityManager
- $_firstResult — integer
- $_maxResults — integer
- $_state — integer
- $_type — integer
- $joinRootAliases — array
- $parameters — \Doctrine\Common\Collections\ArrayCollection
Methods
private
- _getDQLForDelete()
- _getDQLForSelect()
- _getDQLForUpdate()
- _getReducedDQLQueryPart()
- findRootAlias() — Finds the root entity alias of the joined entity.
public
- __construct() — Initializes a new <tt>QueryBuilder</tt> that uses the given <tt>EntityManager</tt>.
- __clone() — Deep clone of all expression objects in the DQL parts.
- __toString() — Gets a string representation of this QueryBuilder which corresponds to the final DQL query being constructed.
- add() — Either appends to or replaces a single, generic query part.
- addGroupBy() — Adds a grouping expression to the query.
- addOrderBy() — Adds an ordering to the query results.
- addSelect() — Adds an item that is to be returned in the query result.
- andHaving() — Adds a restriction over the groups of the query, forming a logical conjunction with any existing having restrictions.
- andWhere() — Adds one or more restrictions to the query results, forming a logical conjunction with any previously specified restrictions.
- delete() — Turns the query being built into a bulk delete query that ranges over a certain entity type.
- distinct() — Add a DISTINCT flag to this query.
- expr() — Gets an ExpressionBuilder used for object-oriented construction of query expressions.
- from() — Create and add a query root corresponding to the entity identified by the given alias, forming a cartesian product with any existing query roots.
- getDQL() — Get the complete DQL string formed by the current specifications of this QueryBuilder.
- getDQLPart() — Get a query part by its name.
- getDQLParts() — Get all query parts.
- getEntityManager() — Get the associated EntityManager for this query builder.
- getFirstResult() — Gets the position of the first result the query object was set to retrieve (the "offset").
- getMaxResults() — Gets the maximum number of results the query object was set to retrieve (the "limit").
- getParameter() — Gets a (previously set) query parameter of the query being constructed.
- getParameters() — Gets all defined query parameters for the query being constructed.
- getQuery() — Constructs a Query instance from the current specifications of the builder.
- getRootAlias() — Gets the FIRST root alias of the query. This is the first entity alias involved in the construction of the query.
- getRootAliases() — Gets the root aliases of the query. This is the entity aliases involved in the construction of the query.
- getRootEntities() — Gets the root entities of the query. This is the entity aliases involved in the construction of the query.
- getState() — Get the state of this query builder instance.
- getType() — Get the type of the currently built query.
- groupBy() — Specifies a grouping over the results of the query.
- having() — Specifies a restriction over the groups of the query.
- innerJoin() — Creates and adds a join over an entity association to the query.
- join() — Creates and adds a join over an entity association to the query.
- leftJoin() — Creates and adds a left join over an entity association to the query.
- orHaving() — Adds a restriction over the groups of the query, forming a logical disjunction with any existing having restrictions.
- orWhere() — Adds one or more restrictions to the query results, forming a logical disjunction with any previously specified restrictions.
- orderBy() — Specifies an ordering for the query results.
- resetDQLPart() — Reset single DQL part
- resetDQLParts() — Reset DQL parts
- select() — Specifies an item that is to be returned in the query result.
- set() — Sets a new value for a field in a bulk update query.
- setFirstResult() — Sets the position of the first result to retrieve (the "offset").
- setMaxResults() — Sets the maximum number of results to retrieve (the "limit").
- setParameter() — Sets a query parameter for the query being constructed.
- setParameters() — Sets a collection of query parameters for the query being constructed.
- update() — Turns the query being built into a bulk update query that ranges over a certain entity type.
- where() — Specifies one or more restrictions to the query result.