create returns a new Doctrine_Query object
Parameters:
API Tags:
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:
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 |
buildFromPart builds the from part of the query and returns it
API Tags:
Return: | the query sql from part |
Access: | public |
array convertEnums(
$params
)
|
|
convertEnums convert enum parameters to their integer equivalents
Parameters:
API Tags:
Return: | converted parameter array |
Access: | public |
Redefinition of:
- Doctrine_Hydrate::convertEnums()
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
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 |
string getAggregateAlias(
string
$dqlAlias
)
|
|
getAggregateAlias
Parameters:
string |
$dqlAlias: |
the dql alias of an aggregate value |
API Tags:
getDql returns the DQL query associated with this object
the query is built from $_dqlParts
API Tags:
Return: | the DQL query |
Access: | public |
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 |
getEnumParams get all enumerated parameters
API Tags:
Return: | all enumerated parameters |
Access: | public |
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 |
getParser parser lazy-loader
Parameters:
API Tags:
Information Tags:
Throws: | Doctrine_Query_Exception if unknown parser name given |
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 |
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 |
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:
void load(
$path, [
$loadFields = true]
)
|
|
Parameters:
API Tags:
void loadRoot(
string
$name, string
$componentAlias
)
|
|
loadRoot
Parameters:
string |
$name: |
|
string |
$componentAlias: |
|
API Tags:
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:
Information Tags:
Throws: | Doctrine_Query_Exception if unknown aggregate function given |
string parseClause(
$clause
)
|
|
parseClause parses given DQL clause
this method handles five tasks:
- Converts all DQL functions to their native SQL equivalents
- Converts all component references to their table alias equivalents
- Converts all column aliases to actual column names
- Quotes all identifiers
- Parses nested clauses and subqueries recursively
Parameters:
API Tags:
Return: | SQL string |
Access: | public |
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:
Information Tags:
Throws: | Doctrine_Query_Exception if some generic parsing error occurs |
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
void parseSelect(
string
$dql
)
|
|
parseSelect parses the query select part and adds selected fields to pendingFields array
Parameters:
API Tags:
void parseSubselect(
string
$reference
)
|
|
parseSubselect
parses the subquery found in DQL SELECT part and adds the parsed form into $pendingSubqueries stack
Parameters:
API Tags:
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:
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:
void processPendingAggregates(
)
|
|
processPendingAggregates processes pending aggregate values for given component alias
API Tags:
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:
Information Tags:
Throws: | Doctrine_Query_Exception if unknown component alias has been given |
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:
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 |
setOption
Parameters:
string |
$name: |
option name |
string |
$value: |
option value |
API Tags:
Return: | this object |
Access: | public |
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:
API Tags:
Return: | an array containing the query string parts |
Access: | public |
Information Tags:
Throws: | Doctrine_Query_Exception if some generic parsing error occurs |