Doctrine\ORM\Query
A Query object represents a DQL query.
- Author: Guilherme Blanco <guilhermeblanco@hotmail.com>
Synopsis
class Query
extends AbstractQuery
{
- // constants
- const STATE_CLEAN = 1;
- const STATE_DIRTY = 2;
- const HINT_REFRESH = 'doctrine.refresh';
- const HINT_REFRESH_ENTITY = 'doctrine.refresh.entity';
- const HINT_FORCE_PARTIAL_LOAD = 'doctrine.forcePartialLoad';
- const HINT_INCLUDE_META_COLUMNS = 'doctrine.includeMetaColumns';
- const HINT_CUSTOM_TREE_WALKERS = 'doctrine.customTreeWalkers';
- const HINT_CUSTOM_OUTPUT_WALKER = 'doctrine.customOutputWalker';
- const HINT_INTERNAL_ITERATION = 'doctrine.internal.iteration';
- const HINT_LOCK_MODE = 'doctrine.lockMode';
- // Inherited constants from AbstractQuery
- const HYDRATE_OBJECT = 1;
- const HYDRATE_ARRAY = 2;
- const HYDRATE_SCALAR = 3;
- const HYDRATE_SINGLE_SCALAR = 4;
- const HYDRATE_SIMPLEOBJECT = 5;
- // members
- private integer $_state;
- private string $_dql;
- private ParserResult $_parserResult;
- private integer $_firstResult;
- private integer $_maxResults;
- private CacheDriver $_queryCache;
- private boolean $_expireQueryCache;
- private int $_queryCacheTTL;
- private boolean $_useQueryCache;
- // Inherited members from AbstractQuery
- protected ArrayCollection $parameters;
- protected ResultSetMapping $_resultSetMapping;
- protected EntityManager $_em;
- protected array $_hints;
- protected integer $_hydrationMode;
- protected $_queryCacheProfile;
- protected boolean $_expireResultCache;
- protected $_hydrationCacheProfile;
- // methods
- public mixed getSQL()
- public SelectStatement getAST()
- private ParserResult _parse()
- protected void _doExecute()
- private array processParameterMappings()
- public Query setQueryCacheDriver()
- public @return useQueryCache()
- public CacheDriver getQueryCacheDriver()
- public Query setQueryCacheLifetime()
- public int getQueryCacheLifetime()
- public Query expireQueryCache()
- public bool getExpireQueryCache()
- public void free()
- public AbstractQuery setDQL()
- public string getDQL()
- public integer getState()
- public boolean contains()
- public Query setFirstResult()
- public integer getFirstResult()
- public Query setMaxResults()
- public integer getMaxResults()
- public IterableResult iterate()
- public void setHint()
- public void setHydrationMode()
- public Query setLockMode()
- public int getLockMode()
- protected string _getQueryCacheId()
- public void __clone()
- // Inherited methods from AbstractQuery
- public void __construct()
- public abstract string getSQL()
- public EntityManager getEntityManager()
- public void free()
- public ArrayCollection getParameters()
- public mixed getParameter()
- public AbstractQuery setParameters()
- public AbstractQuery setParameter()
- public array processParameterValue()
- public AbstractQuery setResultSetMapping()
- public AbstractQuery setHydrationCacheProfile()
- public QueryCacheProfile getHydrationCacheProfile()
- public AbstractQuery setResultCacheProfile()
- public AbstractQuery setResultCacheDriver()
- public Cache getResultCacheDriver()
- public AbstractQuery useResultCache()
- public AbstractQuery setResultCacheLifetime()
- public integer getResultCacheLifetime()
- public AbstractQuery expireResultCache()
- public boolean getExpireResultCache()
- public QueryCacheProfile getQueryCacheProfile()
- public AbstractQuery setFetchMode()
- public AbstractQuery setHydrationMode()
- public integer getHydrationMode()
- public array getResult()
- public array getArrayResult()
- public array getScalarResult()
- public mixed getOneOrNullResult()
- public mixed getSingleResult()
- public mixed getSingleScalarResult()
- public AbstractQuery setHint()
- public mixed getHint()
- public array getHints()
- public IterableResult iterate()
- public mixed execute()
- protected array getHydrationCacheId()
- public AbstractQuery setResultCacheId()
- public string getResultCacheId()
- protected abstract Statement _doExecute()
- public void __clone()
Hierarchy
Extends
Tasks
Line | Task |
---|---|
+ | Rename: HINT_OPTIMIZE |
Constants
Name | Value |
---|---|
STATE_CLEAN | 1 |
STATE_DIRTY | 2 |
HINT_REFRESH | 'doctrine.refresh' |
HINT_REFRESH_ENTITY | 'doctrine.refresh.entity' |
HINT_FORCE_PARTIAL_LOAD | 'doctrine.forcePartialLoad' |
HINT_INCLUDE_META_COLUMNS | 'doctrine.includeMetaColumns' |
HINT_CUSTOM_TREE_WALKERS | 'doctrine.customTreeWalkers' |
HINT_CUSTOM_OUTPUT_WALKER | 'doctrine.customOutputWalker' |
HINT_INTERNAL_ITERATION | 'doctrine.internal.iteration' |
HINT_LOCK_MODE | 'doctrine.lockMode' |
HYDRATE_OBJECT | 1 |
HYDRATE_ARRAY | 2 |
HYDRATE_SCALAR | 3 |
HYDRATE_SINGLE_SCALAR | 4 |
HYDRATE_SIMPLEOBJECT | 5 |
Members
private
- $_dql — string
- $_expireQueryCache — boolean
- $_firstResult — integer
- $_maxResults — integer
- $_parserResult — \Doctrine\ORM\Query\ParserResult
- $_queryCache — Doctrine\ORM\CacheDriver
- $_queryCacheTTL — int
- $_state — integer
- $_useQueryCache — boolean
protected
- $_em — \Doctrine\ORM\EntityManager
- $_expireResultCache — boolean
- $_hints — array
- $_hydrationCacheProfile
- $_hydrationMode — integer
- $_queryCacheProfile
- $_resultSetMapping — Doctrine\ORM\ResultSetMapping
- $parameters — \Doctrine\Common\Collections\ArrayCollection
Methods
private
- _parse() — Parses the DQL query, if necessary, and stores the parser result.
- processParameterMappings() — Processes query parameter mappings
protected
- _doExecute() — {@inheritdoc}
- _getQueryCacheId() — Generate a cache id for the query cache - reusing the Result-Cache-Id generator.
public
- __clone() — Cleanup Query resource when clone is called.
- contains() — Method to check if an arbitrary piece of DQL exists
- expireQueryCache() — Defines if the query cache is active or not.
- free()
- getAST() — Returns the corresponding AST for this DQL query.
- getDQL() — Returns the DQL query that is represented by this query object.
- getExpireQueryCache() — Retrieves if the query cache is active or not.
- getFirstResult() — Gets the position of the first result the query object was set to retrieve (the "offset").
- getLockMode() — Get the current lock mode for this query.
- getMaxResults() — Gets the maximum number of results the query object was set to retrieve (the "limit").
- getQueryCacheDriver() — Returns the cache driver used for query caching.
- getQueryCacheLifetime() — Retrieves the lifetime of resultset cache.
- getSQL() — Gets the SQL query/queries that correspond to this DQL query.
- getState() — Returns the state of this query object By default the type is Doctrine_ORM_Query_Abstract::STATE_CLEAN but if it appears any unprocessed DQL part, it is switched to Doctrine_ORM_Query_Abstract::STATE_DIRTY.
- iterate() — Executes the query and returns an IterableResult that can be used to incrementally iterated over the result.
- setDQL() — Sets a DQL query string.
- setFirstResult() — Sets the position of the first result to retrieve (the "offset").
- setHint() — {@inheritdoc}
- setHydrationMode() — {@inheritdoc}
- setLockMode() — Set the lock mode for this Query.
- setMaxResults() — Sets the maximum number of results to retrieve (the "limit").
- setQueryCacheDriver() — Defines a cache driver to be used for caching queries.
- setQueryCacheLifetime() — Defines how long the query cache will be active before expire.
- useQueryCache() — Defines whether the query should make use of a query cache, if available.
Inherited from Doctrine\ORM\AbstractQuery
protected
- _doExecute() — Executes the query and returns a the resulting Statement object.
- getHydrationCacheId() — Get the result cache id to use to store the result set cache entry.
public
- __clone() — Cleanup Query resource when clone is called.
- execute() — Executes the query.
- expireResultCache() — Defines if the result cache is active or not.
- free() — Frees the resources used by the query object.
- getArrayResult() — Gets the array of results for the query.
- getEntityManager() — Retrieves the associated EntityManager of this Query instance.
- getExpireResultCache() — Retrieves if the resultset cache is active or not.
- getHint() — Gets the value of a query hint. If the hint name is not recognized, FALSE is returned.
- getHints() — Return the key value map of query hints that are currently set.
- getHydrationCacheProfile()
- getHydrationMode() — Gets the hydration mode currently used by the query.
- getOneOrNullResult() — Get exactly one result or null.
- getParameter() — Gets a query parameter.
- getParameters() — Get all defined parameters.
- getQueryCacheProfile()
- getResult() — Gets the list of results for the query.
- getResultCacheDriver() — Returns the cache driver used for caching result sets.
- getResultCacheId() — Get the result cache id to use to store the result set cache entry if set.
- getResultCacheLifetime() — Retrieves the lifetime of resultset cache.
- getSQL() — Gets the SQL query that corresponds to this query object.
- getScalarResult() — Gets the scalar results for the query.
- getSingleResult() — Gets the single result of the query.
- getSingleScalarResult() — Gets the single scalar result of the query.
- iterate() — Executes the query and returns an IterableResult that can be used to incrementally iterate over the result.
- processParameterValue() — Process an individual parameter value
- setFetchMode() — Change the default fetch mode of an association for this query.
- setHint() — Sets a query hint. If the hint name is not recognized, it is silently ignored.
- setHydrationCacheProfile() — Set a cache profile for hydration caching.
- setHydrationMode() — Defines the processing mode to be used during hydration / result set transformation.
- setParameter() — Sets a query parameter.
- setParameters() — Sets a collection of query parameters.
- setResultCacheDriver() — Defines a cache driver to be used for caching result sets and implictly enables caching.
- setResultCacheId() — Set the result cache id to use to store the result set cache entry.
- setResultCacheLifetime() — Defines how long the result cache will be active before expire.
- setResultCacheProfile() — Set a cache profile for the result cache.
- setResultSetMapping() — Sets the ResultSetMapping that should be used for hydration.
- useResultCache() — Set whether or not to cache the results of this query and if so, for how long and which ID to use for the cache entry.