Classes:
Doctrine
Doctrine_Access
Doctrine_Adapter
Doctrine_Adapter_Db2_Exception
Doctrine_Adapter_Exception
Doctrine_Adapter_Statement
Doctrine_AuditLog
Doctrine_AuditLog_Listener
Doctrine_Collection
Doctrine_Collection_Exception
Doctrine_Collection_Iterator
Doctrine_Collection_Iterator_Expandable
Doctrine_Collection_Iterator_Normal
Doctrine_Collection_Iterator_Offset
Doctrine_Collection_Offset
Doctrine_Column
Doctrine_Compiler
Doctrine_Compiler_Exception
Doctrine_Configurable
Doctrine_Connection
Doctrine_Connection_Common
Doctrine_Connection_Db2
Doctrine_Connection_Exception
Doctrine_Connection_Firebird
Doctrine_Connection_Firebird_Exception
Doctrine_Connection_Informix
Doctrine_Connection_Informix_Exception
Doctrine_Connection_Mock
Doctrine_Connection_Module
Doctrine_Connection_Mssql
Doctrine_Connection_Mssql_Exception
Doctrine_Connection_Mysql
Doctrine_Connection_Mysql_Exception
Doctrine_Connection_Oracle
Doctrine_Connection_Oracle_Exception
Doctrine_Connection_Pgsql
Doctrine_Connection_Pgsql_Exception
Doctrine_Connection_Profiler
Doctrine_Connection_Profiler_Exception
Doctrine_Connection_Sqlite
Doctrine_Connection_Sqlite_Exception
Doctrine_Connection_Statement
Doctrine_Connection_UnitOfWork
Doctrine_DataDict
Doctrine_DataDict_Exception
Doctrine_DataDict_Informix
Doctrine_DataType
Doctrine_Db
Doctrine_Event
Doctrine_EventListener
Doctrine_EventListener_Chain
Doctrine_EventListener_Exception
Doctrine_Exception
Doctrine_Export
Doctrine_Export_Exception
Doctrine_Export_Firebird
Doctrine_Export_Frontbase
Doctrine_Export_Mssql
Doctrine_Export_Mysql
Doctrine_Export_Oracle
Doctrine_Export_Pgsql
Doctrine_Export_Reporter
Doctrine_Export_Schema
Doctrine_Export_Schema_Xml
Doctrine_Export_Schema_Yml
Doctrine_Export_Sqlite
Doctrine_Expression
Doctrine_Expression_Driver
Doctrine_Expression_Exception
Doctrine_Expression_Firebird
Doctrine_Expression_Informix
Doctrine_Expression_Mock
Doctrine_Expression_Mssql
Doctrine_Expression_Mysql
Doctrine_Expression_Oracle
Doctrine_Expression_Pgsql
Doctrine_Expression_Sqlite
Doctrine_File
Doctrine_File_Index
Doctrine_Formatter
Doctrine_Hook
Doctrine_Hook_Equal
Doctrine_Hook_Integer
Doctrine_Hook_Parser
Doctrine_Hook_Parser_Complex
Doctrine_Hook_WordLike
Doctrine_Hydrate
Doctrine_Hydrate_Array
Doctrine_Hydrate_Exception
Doctrine_Hydrate_Record
Doctrine_Import
Doctrine_Import_Builder
Doctrine_Import_Builder_BaseClass
Doctrine_Import_Builder_Exception
Doctrine_Import_Exception
Doctrine_Import_Firebird
Doctrine_Import_Informix
Doctrine_Import_Mssql
Doctrine_Import_Mysql
Doctrine_Import_Oracle
Doctrine_Import_Pgsql
Doctrine_Import_Reader
Doctrine_Import_Reader_Db
Doctrine_Import_Reader_Exception
Doctrine_Import_Reader_Xml_Propel
Doctrine_Import_Schema
Doctrine_Import_Schema_Xml
Doctrine_Import_Schema_Yml
Doctrine_Import_Sqlite
Doctrine_IntegrityMapper
Doctrine_Lib
Doctrine_Locking_Exception
Doctrine_Locking_Manager_Pessimistic
Doctrine_Manager
Doctrine_Manager_Exception
Doctrine_Node
Doctrine_Node_AdjacencyList
Doctrine_Node_AdjacencyList_LevelOrderIterator
Doctrine_Node_AdjacencyList_PostOrderIterator
Doctrine_Node_AdjacencyList_PreOrderIterator
Doctrine_Node_Exception
Doctrine_Node_MaterializedPath
Doctrine_Node_MaterializedPath_LevelOrderIterator
Doctrine_Node_MaterializedPath_PostOrderIterator
Doctrine_Node_MaterializedPath_PreOrderIterator
Doctrine_Node_NestedSet
Doctrine_Node_NestedSet_LevelOrderIterator
Doctrine_Node_NestedSet_PostOrderIterator
Doctrine_Node_NestedSet_PreOrderIterator
Doctrine_Null
Doctrine_Object
Doctrine_Plugin
Doctrine_Query
Doctrine_Query_Abstract
Doctrine_Query_Check
Doctrine_Query_Condition
Doctrine_Query_Exception
Doctrine_Query_Filter
Doctrine_Query_Filter_Chain
Doctrine_Query_From
Doctrine_Query_Groupby
Doctrine_Query_Having
Doctrine_Query_JoinCondition
Doctrine_Query_Limit
Doctrine_Query_Offset
Doctrine_Query_Orderby
Doctrine_Query_Parser
Doctrine_Query_Part
Doctrine_Query_Select
Doctrine_Query_Set
Doctrine_Query_Where
Doctrine_RawSql
Doctrine_RawSql_Exception
Doctrine_Record
Doctrine_Record_Abstract
Doctrine_Record_Exception
Doctrine_Record_Filter
Doctrine_Record_Iterator
Doctrine_Record_Listener
Doctrine_Record_Listener_Chain
Doctrine_Record_State_Exception
Doctrine_Relation
Doctrine_Relation_Association
Doctrine_Relation_Association_Self
Doctrine_Relation_Exception
Doctrine_Relation_ForeignKey
Doctrine_Relation_LocalKey
Doctrine_Relation_Nest
Doctrine_Relation_Parser
Doctrine_Relation_Parser_Exception
Doctrine_Schema
Doctrine_Schema_Column
Doctrine_Schema_Database
Doctrine_Schema_Exception
Doctrine_Schema_Object
Doctrine_Schema_Relation
Doctrine_Schema_Table
Doctrine_Search
Doctrine_Search_Analyzer
Doctrine_Search_Analyzer_Exception
Doctrine_Search_Analyzer_Standard
Doctrine_Search_Exception
Doctrine_Search_Indexer
Doctrine_Search_Indexer_Dir
Doctrine_Search_Indexer_Exception
Doctrine_Search_Listener
Doctrine_Search_Parser
Doctrine_Search_Query
Doctrine_Search_Record
Doctrine_Search_Scorer
Doctrine_Search_Template
Doctrine_Sequence
Doctrine_Sequence_Db2
Doctrine_Sequence_Exception
Doctrine_Sequence_Firebird
Doctrine_Sequence_Informix
Doctrine_Sequence_Mssql
Doctrine_Sequence_Mysql
Doctrine_Sequence_Oracle
Doctrine_Sequence_Pgsql
Doctrine_Sequence_Sqlite
Doctrine_Table
Doctrine_Table_Exception
Doctrine_Table_Repository
Doctrine_Table_Repository_Exception
Doctrine_Template
Doctrine_Template_NestedSet
Doctrine_Template_Searchable
Doctrine_Template_Taggable
Doctrine_Template_Versionable
Doctrine_Tokenizer
Doctrine_Transaction
Doctrine_Transaction_Exception
Doctrine_Transaction_Firebird
Doctrine_Transaction_Informix
Doctrine_Transaction_Mock
Doctrine_Transaction_Mssql
Doctrine_Transaction_Mysql
Doctrine_Transaction_Oracle
Doctrine_Transaction_Pgsql
Doctrine_Transaction_Sqlite
Doctrine_Tree
Doctrine_Tree_AdjacencyList
Doctrine_Tree_Exception
Doctrine_Tree_MaterializedPath
Doctrine_Tree_NestedSet
Doctrine_Util
Doctrine_Validator
Doctrine_Validator_Country
Doctrine_Validator_Creditcard
Doctrine_Validator_Date
Doctrine_Validator_Email
Doctrine_Validator_Enum
Doctrine_Validator_ErrorStack
Doctrine_Validator_Exception
Doctrine_Validator_HtmlColor
Doctrine_Validator_Ip
Doctrine_Validator_Minlength
Doctrine_Validator_Nospace
Doctrine_Validator_Notblank
Doctrine_Validator_Notnull
Doctrine_Validator_Range
Doctrine_Validator_Regexp
Doctrine_Validator_Unique
Doctrine_Validator_Unsigned
Doctrine_Validator_Usstate
Doctrine_View
Doctrine_View_Exception
Doctrine_Cache
Doctrine_Cache
Doctrine_Cache_Apc
Doctrine_Cache_Array
Doctrine_Cache_Db
Doctrine_Cache_Driver
Doctrine_Cache_Exception
Doctrine_Cache_Memcache
Doctrine_Adapter
Doctrine_Adapter_Db2
Doctrine_Adapter_Mock
Doctrine_Adapter_Mysqli
Doctrine_Adapter_Oracle
Doctrine_Adapter_Statement_Mock
Doctrine_DataDict
Doctrine_DataDict_Firebird
Doctrine_DataDict_Mssql
Doctrine_DataDict_Mysql
Doctrine_DataDict_Oracle
Doctrine_DataDict_Pgsql
Doctrine_DataDict_Sqlite

# Class: Doctrine_Query

Source Location: /Doctrine/Query.php

## Class Doctrine_Query

Class Overview

Implements interfaces: Countable (internal interface) Doctrine_Query Located in /Doctrine/Query.php [line 33]
    Doctrine_Object
       |
       --Doctrine_Hydrate
          |
          --Doctrine_Query_Abstract
             |
             --Doctrine_Query
Author(s): Konsta Vesterinen <kvesteri@cc.hut.fi> Information Tags:
Version: | $Revision: 2287 $
Link: | www.phpdoctrine.com
Since: | 1.0
License: | LGPL
| Properties $isLimitSubqueryUsed $isSubquery $needsSubquery $pendingFields $pendingSubqueries $subqueryAliases $_dqlParts $_enumParams $_expressionMap $_neededTables $_parsers $_pendingJoinConditions $_state | Methods addEnumParam addPendingJoinCondition buildFromPart convertEnums copy count create free getAggregateAlias getDql getDqlPart getEnumParams getLimitSubquery getParser getQuery getQueryBase isLimitSubqueryUsed isSubquery load loadRoot parseAggregateFunction parseClause parseQuery parseQueryPart parseSelect parseSubselect postQuery preQuery processPendingAggregates processPendingFields processPendingSubqueries query reset setOption tokenizeQuery

[ Top ]
Inherited Properties, Constants, and Methods

Inherited Properties | Inherited Methods | Inherited Constants
--- | --- | ---
Inherited From Doctrine_Hydrate Doctrine_Hydrate::$aggregateMap Doctrine_Hydrate::$parts Doctrine_Hydrate::$pendingAggregates Doctrine_Hydrate::$type Doctrine_Hydrate::$_aliasMap Doctrine_Hydrate::$_cache Doctrine_Hydrate::$_conn Doctrine_Hydrate::$_expireCache Doctrine_Hydrate::$_hydrationMode Doctrine_Hydrate::$_options Doctrine_Hydrate::$_params Doctrine_Hydrate::$_sql Doctrine_Hydrate::$_tableAliases Doctrine_Hydrate::$_tableAliasSeeds Doctrine_Hydrate::$_timeToLive Doctrine_Hydrate::$_view Inherited From Doctrine_Object Doctrine_Object::$_null | Inherited From Doctrine_Query_Abstract Doctrine_Query_Abstract::addFrom() addFrom adds fields to the FROM part of the query Doctrine_Query_Abstract::addGroupBy() addGroupBy adds fields to the GROUP BY part of the query Doctrine_Query_Abstract::addHaving() addHaving adds conditions to the HAVING part of the query Doctrine_Query_Abstract::addOrderBy() addOrderBy adds fields to the ORDER BY part of the query Doctrine_Query_Abstract::addSelect() addSelect adds fields to the SELECT part of the query Doctrine_Query_Abstract::addWhere() addWhere adds conditions to the WHERE part of the query Doctrine_Query_Abstract::delete() delete sets the query type to DELETE Doctrine_Query_Abstract::distinct() distinct Makes the query SELECT DISTINCT. Doctrine_Query_Abstract::forUpdate() forUpdate Makes the query SELECT FOR UPDATE. Doctrine_Query_Abstract::from() from sets the FROM part of the query Doctrine_Query_Abstract::groupBy() groupBy sets the GROUP BY part of the query Doctrine_Query_Abstract::having() having sets the HAVING part of the query Doctrine_Query_Abstract::innerJoin() innerJoin appends an INNER JOIN to the FROM part of the query Doctrine_Query_Abstract::leftJoin() leftJoin appends a LEFT JOIN to the FROM part of the query Doctrine_Query_Abstract::limit() limit sets the Query query limit Doctrine_Query_Abstract::offset() offset sets the Query query offset Doctrine_Query_Abstract::orderBy() orderBy sets the ORDER BY part of the query Doctrine_Query_Abstract::parseQueryPart() parseQueryPart parses given DQL query part Doctrine_Query_Abstract::select() select sets the SELECT part of the query Doctrine_Query_Abstract::set() set sets the SET part of the query Doctrine_Query_Abstract::update() update sets the UPDATE part of the query Doctrine_Query_Abstract::where() where sets the WHERE part of the query Doctrine_Query_Abstract::whereIn() whereIn adds IN condition to the query WHERE part Inherited From Doctrine_Hydrate Doctrine_Hydrate::__construct() constructor Doctrine_Hydrate::addQueryPart() addQueryPart adds a query part in the query part array Doctrine_Hydrate::addTableAlias() addTableAlias adds an alias for table and associates it with given component alias Doctrine_Hydrate::applyInheritance() applyInheritance applies column aggregation inheritance to DQL / SQL query Doctrine_Hydrate::clear() clear resets all the variables Doctrine_Hydrate::convertEnums() Doctrine_Hydrate::copyAliases() copyAliases copy aliases from another Hydrate object Doctrine_Hydrate::createSubquery() createSubquery creates a subquery Doctrine_Hydrate::execute() execute executes the query and populates the data set Doctrine_Hydrate::expireCache() expireCache Doctrine_Hydrate::fetchArray() fetchArray Convenience method to execute using array fetching as hydration mode. Doctrine_Hydrate::fetchOne() fetchOne Convenience method to execute the query and return the first item of the collection. Doctrine_Hydrate::generateNewTableAlias() generateNewTableAlias generates a new alias from given table alias Doctrine_Hydrate::generateTableAlias() generateTableAlias generates a table alias from given table name and associates it with given component alias Doctrine_Hydrate::getAliasDeclaration() getAliasDeclaration get the declaration for given component alias Doctrine_Hydrate::getAliasMap() getAliasMap returns the component alias map Doctrine_Hydrate::getCachedForm() getCachedForm returns the cached form of this query for given resultSet Doctrine_Hydrate::getCacheDriver() getCacheDriver returns the cache driver associated with this object Doctrine_Hydrate::getComponentAlias() getComponentAlias get component alias associated with given table alias Doctrine_Hydrate::getConnection() getConnection Doctrine_Hydrate::getParams() getParams Doctrine_Hydrate::getQueryPart() setQueryPart sets a query part in the query part array Doctrine_Hydrate::getRoot() getRoot returns the root component for this object Doctrine_Hydrate::getRootAlias() getRootAlias returns the alias of the the root component Doctrine_Hydrate::getRootDeclaration() getRootDeclaration returns the root declaration Doctrine_Hydrate::getSql() getSql return the sql associated with this object Doctrine_Hydrate::getTableAlias() getTableAlias some database such as Oracle need the identifier lengths to be < ~30 chars hence Doctrine creates as short identifier aliases as possible Doctrine_Hydrate::getTableAliases() getTableAliases returns all table aliases Doctrine_Hydrate::getTableAliasSeed() getTableAliasSeed returns the alias seed for given table alias Doctrine_Hydrate::getType() getType Doctrine_Hydrate::getView() getView returns the view associated with this query object (if any) Doctrine_Hydrate::hasAliasDeclaration() hasAliasDeclaration whether or not this object has a declaration for given component alias Doctrine_Hydrate::hasTableAlias() hasTableAlias whether or not this object has given tableAlias Doctrine_Hydrate::isLimitSubqueryUsed() limitSubqueryUsed whether or not limit subquery was used Doctrine_Hydrate::parseData2() parseData parses the data returned by statement object Doctrine_Hydrate::removeQueryPart() removeQueryPart removes a query part from the query part array Doctrine_Hydrate::serialize() serialize this method is automatically called when this Doctrine_Hydrate is serialized Doctrine_Hydrate::setAliasMap() setAliasMap sets the whole component alias map Doctrine_Hydrate::setCacheLifeSpan() setCacheLifeSpan Doctrine_Hydrate::setHydrationMode() Sets the fetchmode. Doctrine_Hydrate::setParams() setParams Doctrine_Hydrate::setQueryPart() setQueryPart sets a query part in the query part array Doctrine_Hydrate::setView() setView sets a database view this query object uses this method should only be called internally by doctrine Doctrine_Hydrate::unserialize() unseralize this method is automatically called everytime a Doctrine_Hydrate object is unserialized Doctrine_Hydrate::useCache() useCache Doctrine_Hydrate::_execute() Doctrine_Hydrate::_setLastElement() _setLastElement Doctrine_Hydrate::__toString() Inherited From Doctrine_Object Doctrine_Object::getNullObject() getNullObject returns the null object associated with this object Doctrine_Object::initNullObject() initNullObject initializes the null object | Inherited From Doctrine_Hydrate Doctrine_Hydrate::CREATE Doctrine_Hydrate::DELETE Doctrine_Hydrate::HYDRATE_ARRAY Doctrine_Hydrate::HYDRATE_RECORD Doctrine_Hydrate::INSERT Doctrine_Hydrate::SELECT Doctrine_Hydrate::UPDATE

[ Top ]
Constant Summary

STATE_CLEAN |
STATE_DIRECT |
STATE_DIRTY |
STATE_LOCKED |

[ Top ]
Property Summary

mixed | $isLimitSubqueryUsed |
mixed | $isSubquery |
mixed | $needsSubquery |
array | $pendingFields |
array | $pendingSubqueries |
mixed | $subqueryAliases |
array | $_dqlParts |
array | $_enumParams |
mixed | $_expressionMap |
array | $_neededTables |
array | $_parsers |
array | $_pendingJoinConditions |
mixed | $_state |

[ Top ]
Method Summary

static Doctrine_Query | create() | create returns a new Doctrine_Query object
Doctrine_Query | addEnumParam() | addEnumParam sets input parameter as an enumerated parameter
Doctrine_Query | addPendingJoinCondition() | addPendingJoinCondition
string | buildFromPart() | buildFromPart builds the from part of the query and returns it
array | convertEnums() | convertEnums convert enum parameters to their integer equivalents
void | copy() |
integer | count() | count fetches the count of the query
Doctrine_Query | free() | Frees the resources used by the query object. It especially breaks a cyclic reference between the query object and it's parsers. This enables PHP's current GC to reclaim the memory.
string | getAggregateAlias() | getAggregateAlias
string | getDql() | getDql returns the DQL query associated with this object
string | getDqlPart() | getDqlPart returns the given DQL query part
array | getEnumParams() | getEnumParams get all enumerated parameters
string | getLimitSubquery() | getLimitSubquery this is method is used by the record limit algorithm
Doctrine_Query_Part | getParser() | getParser parser lazy-loader
string | getQuery() | builds the sql query from the given parameters and applies things such as column aggregation inheritance and limit subqueries if needed
string | getQueryBase() | getQueryBase returns the base of the generated sql query On mysql driver special strategy has to be used for DELETE statements
boolean | isLimitSubqueryUsed() | limitSubqueryUsed
Doctrine_Query|bool | isSubquery() | isSubquery
void | load() |
void | loadRoot() | loadRoot
array | parseAggregateFunction() | parseAggregateFunction parses an aggregate function and returns the parsed form
string | parseClause() | parseClause parses given DQL clause
Doctrine_Query | parseQuery() | DQL PARSER
Doctrine_Query | parseQueryPart() | parseQueryPart parses given DQL query part
void | parseSelect() | parseSelect parses the query select part and adds selected fields to pendingFields array
void | parseSubselect() | parseSubselect
void | postQuery() | postQuery
void | preQuery() | preQuery
void | processPendingAggregates() | processPendingAggregates processes pending aggregate values for given component alias
void | processPendingFields() | processPendingFields the fields in SELECT clause cannot be parsed until the components in FROM clause are parsed, hence this method is called everytime a specific component is being parsed.
void | processPendingSubqueries() | processPendingSubqueries processes pending subqueries
mixed | query() | query query the database with DQL (Doctrine Query Language)
void | reset() |
Doctrine_Query | setOption() | setOption
array | tokenizeQuery() | tokenizeQuery

[ Top ]
Properties
mixed $isLimitSubqueryUsed = false [line 55]
API Tags:

Access: | protected

[ Top ]
mixed $isSubquery [line 53]
API Tags:

Access: | protected

[ Top ]
mixed $needsSubquery = false [line 48]
API Tags:

Access: | protected

[ Top ]
array $pendingFields = array() [line 63]
API Tags:

Access: | protected

[ Top ]
array $pendingSubqueries = array() [line 68]
API Tags:

Access: | protected

[ Top ]
mixed $subqueryAliases = array() [line 44]
API Tags:

Access: | protected

[ Top ]
array $_dqlParts = array(
'select' => array(),'forUpdate'=>false,'from'=>array(),'set'=>array(),'join'=>array(),'where'=>array(),'groupby'=>array(),'having'=>array(),'orderby'=>array(),'limit'=>array(),'offset'=>array(),) [line 81]
API Tags:

Access: | protected

[ Top ]
array $_enumParams = array() [line 76]
API Tags:

Access: | protected

[ Top ]
mixed $_expressionMap = array() [line 99]
API Tags:

Access: | protected

[ Top ]
array $_neededTables = array() [line 59]
API Tags:

Access: | protected

[ Top ]
array $_parsers = array() [line 72]
API Tags:

Access: | protected

[ Top ]
array $_pendingJoinConditions = array() [line 97]
API Tags:

Access: | protected

[ Top ]
mixed $_state = Doctrine_Query::STATE_CLEAN [line 101]
API Tags:

Access: | protected

[ Top ]
Methods
static method create [line 110]

`static Doctrine_Query create( [Doctrine_Connection $conn = null] )`

create returns a new Doctrine_Query object

Parameters:

Doctrine_Connection | $conn: | optional connection parameter

API Tags:

Access: | public

[ Top ]
addEnumParam [line 157]

`Doctrine_Query addEnumParam( string $key, [ $table = null], [ $column = null] )`

addEnumParam sets input parameter as an enumerated parameter

Parameters:

string | $key: | the key of the input parameter
| $table: |
| $column: |

API Tags:

Access: | public

[ Top ]
addPendingJoinCondition [line 146]

`Doctrine_Query addPendingJoinCondition( string $componentAlias, string $joinCondition )`

addPendingJoinCondition

Parameters:

string | $componentAlias: | component alias
string | $joinCondition: | dql join condition

API Tags:

Return: | this object
Access: | public

[ Top ]
buildFromPart [line 744]

`string buildFromPart( )`

buildFromPart builds the from part of the query and returns it

API Tags:

Return: | the query sql from part
Access: | public

[ Top ]
convertEnums [line 192]

`array convertEnums( $params )`

convertEnums convert enum parameters to their integer equivalents

Parameters:

| $params: |

API Tags:

Return: | converted parameter array
Access: | public

Redefinition of:

Doctrine_Hydrate::convertEnums()

[ Top ]
copy [line 1535]

`void copy( [Doctrine_Query $query = null] )`

Parameters:

Doctrine_Query | $query: |

API Tags:

Access: | public

[ Top ]
count [line 1463]

`integer count( [array $params = array()] )`

count fetches the count of the query

This method executes the main query without all the selected fields, ORDER BY part, LIMIT part and OFFSET part.

Example: Main query: SELECT u.*, p.phonenumber FROM User u LEFT JOIN u.Phonenumber p WHERE p.phonenumber = '123 123' LIMIT 10

The modified DQL query: SELECT COUNT(DISTINCT u.id) FROM User u LEFT JOIN u.Phonenumber p WHERE p.phonenumber = '123 123'

Parameters:

array | $params: | an array of prepared statement parameters

API Tags:

Return: | the count of this query
Access: | public

Implementation of:

Countable::count

[ Top ]
free [line 1557]

`Doctrine_Query free( )`

Frees the resources used by the query object. It especially breaks a cyclic reference between the query object and it's parsers. This enables PHP's current GC to reclaim the memory.

This method can therefore be used to reduce memory usage when creating a lot of query objects during a request.

API Tags:

Return: | this object
Access: | public

[ Top ]
getAggregateAlias [line 231]

`string getAggregateAlias( string $dqlAlias )`

getAggregateAlias

Parameters:

string | $dqlAlias: | the dql alias of an aggregate value

API Tags:

Access: | public

[ Top ]
getDql [line 339]

`string getDql( )`

getDql returns the DQL query associated with this object

the query is built from $_dqlParts

API Tags:

Return: | the DQL query
Access: | public

[ Top ]
getDqlPart [line 323]

`string getDqlPart( string $queryPart )`

getDqlPart returns the given DQL query part

Parameters:

string | $queryPart: | the name of the query part

API Tags:

Return: | the DQL query part
Access: | public

[ Top ]
getEnumParams [line 173]

`array getEnumParams( )`

getEnumParams get all enumerated parameters

API Tags:

Return: | all enumerated parameters
Access: | public

[ Top ]
getLimitSubquery [line 971]

`string getLimitSubquery( )`

getLimitSubquery this is method is used by the record limit algorithm

when fetching one-to-many, many-to-many associated data with LIMIT clause an additional subquery is needed for limiting the number of returned records instead of limiting the number of sql result set rows

API Tags:

Return: | the limit subquery
Access: | public

[ Top ]
getParser [line 253]

`Doctrine_Query_Part getParser( $name )`

getParser parser lazy-loader

Parameters:

| $name: |

API Tags:

Access: | public

Information Tags:

Throws: | Doctrine_Query_Exception if unknown parser name given

[ Top ]
getQuery [line 822]

`string getQuery( [array $params = array()] )`

builds the sql query from the given parameters and applies things such as column aggregation inheritance and limit subqueries if needed

Parameters:

array | $params: | an array of prepared statement params (needed only in mysql driver when limit subquery algorithm is used)

API Tags:

Return: | the built sql query
Access: | public

[ Top ]
getQueryBase [line 721]

`string getQueryBase( )`

getQueryBase returns the base of the generated sql query On mysql driver special strategy has to be used for DELETE statements

API Tags:

Return: | the base of the generated sql query
Access: | public

[ Top ]
isLimitSubqueryUsed [line 182]

`boolean isLimitSubqueryUsed( )`

limitSubqueryUsed

API Tags:

Access: | public

Redefinition of:

Doctrine_Hydrate::isLimitSubqueryUsed()
  limitSubqueryUsed whether or not limit subquery was used

[ Top ]
isSubquery [line 216]

`Doctrine_Query|bool isSubquery( [boolean $bool = null] )`

isSubquery

if $bool parameter is set this method sets the value of Doctrine_Query::$isSubquery. If this value is set to true the query object will not load the primary key fields of the selected components.

If null is given as the first parameter this method retrieves the current value of Doctrine_Query::$isSubquery.

Parameters:

boolean | $bool: | whether or not this query acts as a subquery

API Tags:

Access: | public

[ Top ]
load [line 1218]

`void load( $path, [ $loadFields = true] )`

Parameters:

| $path: |
| $loadFields: |

API Tags:

Access: | public

[ Top ]
loadRoot [line 1418]

`void loadRoot( string $name, string $componentAlias )`

loadRoot

Parameters:

string | $name: |
string | $componentAlias: |

API Tags:

Access: | public

[ Top ]
parseAggregateFunction [line 562]

`array parseAggregateFunction( string $expr, [ $nestedCall = false] )`

parseAggregateFunction parses an aggregate function and returns the parsed form

Parameters:

string | $expr: | DQL aggregate function
| $nestedCall: |

API Tags:

Return: | parsed form of given function
See: | Doctrine_Expression
Access: | public

Information Tags:

Throws: | Doctrine_Query_Exception if unknown aggregate function given

[ Top ]
parseClause [line 473]

`string parseClause( $clause )`

parseClause parses given DQL clause

this method handles five tasks:

1. Converts all DQL functions to their native SQL equivalents
2. Converts all component references to their table alias equivalents
3. Converts all column aliases to actual column names
4. Quotes all identifiers
5. Parses nested clauses and subqueries recursively

Parameters:

| $clause: |

API Tags:

Return: | SQL string
Access: | public

[ Top ]
parseQuery [line 1165]

`Doctrine_Query parseQuery( string $query, [boolean $clear = true] )`

DQL PARSER

parses a DQL query first splits the query in parts and then uses individual parsers for each part

Parameters:

string | $query: | DQL query
boolean | $clear: | whether or not to clear the aliases

API Tags:

Access: | public

Information Tags:

Throws: | Doctrine_Query_Exception if some generic parsing error occurs

[ Top ]
parseQueryPart [line 280]

`Doctrine_Query parseQueryPart( string $queryPartName, string $queryPart, [boolean $append = false] )`

parseQueryPart parses given DQL query part

Parameters:

string | $queryPartName: | the name of the query part
string | $queryPart: | query part to be parsed
boolean | $append: | whether or not to append the query part to its stack if false is given, this method will overwrite the given query part stack with $queryPart

API Tags:

Return: | this object
Access: | public

Redefinition of:

Doctrine_Query_Abstract::parseQueryPart()
  parseQueryPart parses given DQL query part

[ Top ]
parseSelect [line 400]

`void parseSelect( string $dql )`

parseSelect parses the query select part and adds selected fields to pendingFields array

Parameters:

string | $dql: |

API Tags:

Access: | public

[ Top ]
parseSubselect [line 443]

`void parseSubselect( string $reference )`

parseSubselect

parses the subquery found in DQL SELECT part and adds the parsed form into $pendingSubqueries stack

Parameters:

string | $reference: |

API Tags:

Access: | public

[ Top ]
postQuery [line 810]

`void postQuery( )`

postQuery

Empty template method to provide Query subclasses with the possibility to hook into the query building procedure, doing any custom / specialized post query procedures (for example logging) that are neccessary.

API Tags:

Access: | public

[ Top ]
preQuery [line 797]

`void preQuery( )`

preQuery

Empty template method to provide Query subclasses with the possibility to hook into the query building procedure, doing any custom / specialized query building procedures that are neccessary.

API Tags:

Access: | public

[ Top ]
processPendingAggregates [line 648]

`void processPendingAggregates( )`

processPendingAggregates processes pending aggregate values for given component alias

API Tags:

Access: | public

[ Top ]
processPendingFields [line 363]

`void processPendingFields( string $componentAlias )`

processPendingFields the fields in SELECT clause cannot be parsed until the components in FROM clause are parsed, hence this method is called everytime a specific component is being parsed.

Parameters:

string | $componentAlias: | the alias of the component

API Tags:

Access: | public

Information Tags:

Throws: | Doctrine_Query_Exception if unknown component alias has been given

[ Top ]
processPendingSubqueries [line 620]

`void processPendingSubqueries( )`

processPendingSubqueries processes pending subqueries

subqueries can only be processed when the query is fully constructed since some subqueries may be correlated

API Tags:

Access: | public

[ Top ]
query [line 1528]

`mixed query( string $query, [array $params = array()] )`

query query the database with DQL (Doctrine Query Language)

Parameters:

string | $query: | DQL query
array | $params: | prepared statement parameters

API Tags:

See: | Doctrine::FETCH_* constants
Access: | public

[ Top ]
reset [line 114]

`void reset( )`

API Tags:

Access: | public

[ Top ]
setOption [line 132]

`Doctrine_Query setOption( string $name, string $value )`

setOption

Parameters:

string | $name: | option name
string | $value: | option value

API Tags:

Return: | this object
Access: | public

[ Top ]
tokenizeQuery [line 1114]

`array tokenizeQuery( string $query )`

tokenizeQuery

splits the given dql query into an array where keys represent different query part names and values are arrays splitted using sqlExplode method

example:

parameter: $query = "SELECT u.* FROM User u WHERE u.name LIKE ?" returns: array('select' => array('u.*'), 'from' => array('User', 'u'), 'where' => array('u.name', 'LIKE', '?'))

Parameters:

string | $query: | DQL query

API Tags:

Return: | an array containing the query string parts
Access: | public

Information Tags:

Throws: | Doctrine_Query_Exception if some generic parsing error occurs

[ Top ]
Constants
STATE_CLEAN = 1 [line 35]
[ Top ]
STATE_DIRECT = 3 [line 39]
[ Top ]
STATE_DIRTY = 2 [line 37]
[ Top ]
STATE_LOCKED = 4 [line 41]
[ Top ]