Doctrine


Doctrine\ORM\Query\Parser
/Doctrine/ORM/Query/Parser.php at line 39

Class Parser

Parser

public class Parser

An LL(*) recursive-descent parser for the context-free grammar of the Doctrine Query Language. Parses a DQL query, reports any errors in it, and generates an AST.

License:
http://www.opensource.org/licenses/lgpl-license.php LGPL
See Also:
www.doctrine-project.org
Since:
2.0
Version:
$Revision: 3938 $
Author:
Guilherme Blanco
Jonathan Wage
Roman Borschel
Janne Vanhala

Constructor Summary

Parser(Query query)

Creates a new query parser object.

Method Summary
string

AbstractSchemaName()

AbstractSchemaName ::= identifier

\Doctrine\ORM\Query\AST\AggregateExpression

AggregateExpression()

AggregateExpression ::= ("AVG" | "MAX" | "MIN" | "SUM") "(" ["DISTINCT"] StateFieldPathExpression ")" | "COUNT" "(" ["DISTINCT"] (IdentificationVariable | SingleValuedPathExpression) ")"

string

AliasIdentificationVariable()

AliasIdentificationVariable = identifier

string

AliasResultVariable()

AliasResultVariable ::= identifier

\Doctrine\ORM\Query\AST\ArithmeticExpression

ArithmeticExpression()

ArithmeticExpression ::= SimpleArithmeticExpression | "(" Subselect ")"

\Doctrine\ORM\Query\AST\ArithmeticFactor

ArithmeticFactor()

ArithmeticFactor ::= [("+" | "-")] ArithmeticPrimary

void

ArithmeticPrimary()

ArithmeticPrimary ::= SingleValuedPathExpression | Literal | "(" SimpleArithmeticExpression ")" | FunctionsReturningNumerics | AggregateExpression | FunctionsReturningStrings | FunctionsReturningDatetime | IdentificationVariable

\Doctrine\ORM\Query\AST\ArithmeticTerm

ArithmeticTerm()

ArithmeticTerm ::= ArithmeticFactor {("*" | "/") ArithmeticFactor}

\Doctrine\ORM\Query\AST\PathExpression

AssociationPathExpression()

AssociationPathExpression ::= CollectionValuedPathExpression | SingleValuedAssociationPathExpression

\Doctrine\ORM\Query\AST\BetweenExpression

BetweenExpression()

BetweenExpression ::= ArithmeticExpression ["NOT"] "BETWEEN" ArithmeticExpression "AND" ArithmeticExpression

void

CaseExpression()

\Doctrine\ORM\Query\AST\CollectionMemberExpression

CollectionMemberExpression()

CollectionMemberExpression ::= EntityExpression ["NOT"] "MEMBER" ["OF"] CollectionValuedPathExpressionEntityExpression ::= SingleValuedAssociationPathExpression | SimpleEntityExpression SimpleEntityExpression ::= IdentificationVariable | InputParameter

\Doctrine\ORM\Query\AST\PathExpression

CollectionValuedPathExpression()

CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField

\Doctrine\ORM\Query\AST\ComparisonExpression

ComparisonExpression()

ComparisonExpression ::= ArithmeticExpression ComparisonOperator ( QuantifiedExpression | ArithmeticExpression )

string

ComparisonOperator()

ComparisonOperator ::= "=" | "=" | "!="

\Doctrine\ORM\Query\AST\ConditionalExpression

ConditionalExpression()

ConditionalExpression ::= ConditionalTerm {"OR" ConditionalTerm}

\Doctrine\ORM\Query\AST\ConditionalFactor

ConditionalFactor()

ConditionalFactor ::= ["NOT"] ConditionalPrimary

Doctrine\ORM\Query\AST\ConditionalPrimary

ConditionalPrimary()

ConditionalPrimary ::= SimpleConditionalExpression | "(" ConditionalExpression ")"

\Doctrine\ORM\Query\AST\ConditionalTerm

ConditionalTerm()

ConditionalTerm ::= ConditionalFactor {"AND" ConditionalFactor}

void

CustomFunctionsReturningDatetime()

void

CustomFunctionsReturningNumerics()

void

CustomFunctionsReturningStrings()

\Doctrine\ORM\Query\AST\DeleteClause

DeleteClause()

DeleteClause ::= "DELETE" ["FROM"] AbstractSchemaName ["AS"] AliasIdentificationVariable

\Doctrine\ORM\Query\AST\DeleteStatement

DeleteStatement()

DeleteStatement ::= DeleteClause [WhereClause]

\Doctrine\ORM\Query\AST\EmptyCollectionComparisonExpression

EmptyCollectionComparisonExpression()

EmptyCollectionComparisonExpression ::= CollectionValuedPathExpression "IS" ["NOT"] "EMPTY"

\Doctrine\ORM\Query\AST\SingleValuedAssociationPathExpression

EntityExpression()

EntityExpression ::= SingleValuedAssociationPathExpression | SimpleEntityExpression

\Doctrine\ORM\Query\AST\ExistsExpression

ExistsExpression()

ExistsExpression ::= ["NOT"] "EXISTS" "(" Subselect ")"

\Doctrine\ORM\Query\AST\FromClause

FromClause()

FromClause ::= "FROM" IdentificationVariableDeclaration {"," IdentificationVariableDeclaration}

void

FunctionDeclaration()

FunctionDeclaration ::= FunctionsReturningStrings | FunctionsReturningNumerics | FunctionsReturningDatetime

void

FunctionsReturningDatetime()

FunctionsReturningDateTime ::= "CURRENT_DATE" | "CURRENT_TIME" | "CURRENT_TIMESTAMP"

void

FunctionsReturningNumerics()

FunctionsReturningNumerics ::= "LENGTH" "(" StringPrimary ")" | "LOCATE" "(" StringPrimary "," StringPrimary ["," SimpleArithmeticExpression]")" | "ABS" "(" SimpleArithmeticExpression ")" | "SQRT" "(" SimpleArithmeticExpression ")" | "MOD" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")" | "SIZE" "(" CollectionValuedPathExpression ")"

void

FunctionsReturningStrings()

FunctionsReturningStrings ::= "CONCAT" "(" StringPrimary "," StringPrimary ")" | "SUBSTRING" "(" StringPrimary "," SimpleArithmeticExpression "," SimpleArithmeticExpression ")" | "TRIM" "(" [["LEADING" | "TRAILING" | "BOTH"] [char] "FROM"] StringPrimary ")" | "LOWER" "(" StringPrimary ")" | "UPPER" "(" StringPrimary ")"

\Doctrine\ORM\Query\AST\GroupByClause

GroupByClause()

GroupByClause ::= "GROUP" "BY" GroupByItem {"," GroupByItem}

string

GroupByItem()

GroupByItem ::= IdentificationVariable | SingleValuedPathExpression

\Doctrine\ORM\Query\AST\HavingClause

HavingClause()

HavingClause ::= "HAVING" ConditionalExpression

string

IdentificationVariable()

IdentificationVariable ::= identifier

\Doctrine\ORM\Query\AST\IdentificationVariableDeclaration

IdentificationVariableDeclaration()

IdentificationVariableDeclaration ::= RangeVariableDeclaration [IndexBy] {JoinVariableDeclaration}

\Doctrine\ORM\Query\AST\InExpression

InExpression()

InExpression ::= StateFieldPathExpression ["NOT"] "IN" "(" (InParameter {"," InParameter}* | Subselect) ")"

string

InParameter()

InParameter ::= Literal | InputParameter

Doctrine\ORM\Query\AST\IndexBy

IndexBy()

IndexBy ::= "INDEX" "BY" SimpleStateFieldPathExpression

\Doctrine\ORM\Query\AST\InputParameter

InputParameter()

InputParameter ::= PositionalParameter | NamedParameter

Doctrine\ORM\Query\AST\Join

Join()

Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" JoinAssociationPathExpression ["AS"] AliasIdentificationVariable ["WITH" ConditionalExpression]

\Doctrine\ORM\Query\AST\JoinAssociationPathExpression

JoinAssociationPathExpression()

JoinAssociationPathExpression ::= IdentificationVariable "." (CollectionValuedAssociationField | SingleValuedAssociationField)

\Doctrine\ORM\Query\AST\JoinVariableDeclaration

JoinVariableDeclaration()

JoinVariableDeclaration ::= Join [IndexBy]

\Doctrine\ORM\Query\AST\LikeExpression

LikeExpression()

LikeExpression ::= StringExpression ["NOT"] "LIKE" (string | input_parameter) ["ESCAPE" char]

string

Literal()

Literal ::= string | char | integer | float | boolean

void

NewValue()

NewValue ::= SimpleArithmeticExpression | StringPrimary | DatetimePrimary | BooleanPrimary | EnumPrimary | SimpleEntityExpression | "NULL"NOTE: Since it is not possible to correctly recognize individual types, here is the full grammar that needs to be supported:NewValue ::= SimpleArithmeticExpression | "NULL"SimpleArithmeticExpression covers all *Primary grammar rules and also SimplEntityExpression

\Doctrine\ORM\Query\AST\NullComparisonExpression

NullComparisonExpression()

NullComparisonExpression ::= (SingleValuedPathExpression | InputParameter) "IS" ["NOT"] "NULL"

\Doctrine\ORM\Query\AST\OrderByClause

OrderByClause()

OrderByClause ::= "ORDER" "BY" OrderByItem {"," OrderByItem}

\Doctrine\ORM\Query\AST\OrderByItem

OrderByItem()

OrderByItem ::= (ResultVariable | StateFieldPathExpression) ["ASC" | "DESC"]

array

PartialObjectExpression()

PartialObjectExpression ::= "PARTIAL" IdentificationVariable "." PartialFieldSet PartialFieldSet ::= "{" SimpleStateField {"," SimpleStateField}* "}"

\Doctrine\ORM\Query\AST\PathExpression

PathExpression(integer expectedTypes)

Parses an arbitrary path expression and defers semantical validation based on expected types.

\Doctrine\ORM\Query\AST\QuantifiedExpression

QuantifiedExpression()

QuantifiedExpression ::= ("ALL" | "ANY" | "SOME") "(" Subselect ")"

\Doctrine\ORM\Query\AST\SelectStatement

QueryLanguage()

QueryLanguage ::= SelectStatement | UpdateStatement | DeleteStatement

Doctrine\ORM\Query\AST\RangeVariableDeclaration

RangeVariableDeclaration()

RangeVariableDeclaration ::= AbstractSchemaName ["AS"] AliasIdentificationVariable

string

ResultVariable()

ResultVariable ::= identifier

mixed

ScalarExpression()

ScalarExpression ::= SimpleArithmeticExpression | StringPrimary | DateTimePrimary | StateFieldPathExpression | BooleanPrimary | CaseExpression | EntityTypeExpression

\Doctrine\ORM\Query\AST\SelectClause

SelectClause()

SelectClause ::= "SELECT" ["DISTINCT"] SelectExpression {"," SelectExpression}

Doctrine\ORM\Query\AST\SelectExpression

SelectExpression()

SelectExpression ::= IdentificationVariable | StateFieldPathExpression | (AggregateExpression | "(" Subselect ")" | ScalarExpression) [["AS"] AliasResultVariable]

\Doctrine\ORM\Query\AST\SelectStatement

SelectStatement()

SelectStatement ::= SelectClause FromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause]

\Doctrine\ORM\Query\AST\SimpleArithmeticExpression

SimpleArithmeticExpression()

SimpleArithmeticExpression ::= ArithmeticTerm {("+" | "-") ArithmeticTerm}

void

SimpleConditionalExpression()

SimpleConditionalExpression ::= ComparisonExpression | BetweenExpression | LikeExpression | InExpression | NullComparisonExpression | ExistsExpression | EmptyCollectionComparisonExpression | CollectionMemberExpression

string

SimpleEntityExpression()

SimpleEntityExpression ::= IdentificationVariable | InputParameter

\Doctrine\ORM\Query\AST\SimpleSelectClause

SimpleSelectClause()

SimpleSelectClause ::= "SELECT" ["DISTINCT"] SimpleSelectExpression

\Doctrine\ORM\Query\AST\SimpleSelectExpression

SimpleSelectExpression()

SimpleSelectExpression ::= StateFieldPathExpression | IdentificationVariable | (AggregateExpression [["AS"] AliasResultVariable])

\Doctrine\ORM\Query\AST\PathExpression

SimpleStateFieldPathExpression()

SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField

\Doctrine\ORM\Query\AST\PathExpression

SingleValuedAssociationPathExpression()

SingleValuedAssociationPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* SingleValuedAssociationField

\Doctrine\ORM\Query\AST\PathExpression

SingleValuedPathExpression()

SingleValuedPathExpression ::= StateFieldPathExpression | SingleValuedAssociationPathExpression

\Doctrine\ORM\Query\AST\PathExpression

StateFieldPathExpression()

StateFieldPathExpression ::= SimpleStateFieldPathExpression | SimpleStateFieldAssociationPathExpression

\Doctrine\ORM\Query\AST\StringPrimary

StringExpression()

StringExpression ::= StringPrimary | "(" Subselect ")"

void

StringPrimary()

StringPrimary ::= StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression

\Doctrine\ORM\Query\AST\Subselect

Subselect()

Subselect ::= SimpleSelectClause SubselectFromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause]

\Doctrine\ORM\Query\AST\SubselectFromClause

SubselectFromClause()

SubselectFromClause ::= "FROM" SubselectIdentificationVariableDeclaration {"," SubselectIdentificationVariableDeclaration}

\Doctrine\ORM\Query\AST\SubselectIdentificationVariableDeclaration

SubselectIdentificationVariableDeclaration()

SubselectIdentificationVariableDeclaration ::= IdentificationVariableDeclaration | (AssociationPathExpression ["AS"] AliasIdentificationVariable)

\Doctrine\ORM\Query\AST\UpdateClause

UpdateClause()

UpdateClause ::= "UPDATE" AbstractSchemaName ["AS"] AliasIdentificationVariable "SET" UpdateItem {"," UpdateItem}

\Doctrine\ORM\Query\AST\UpdateItem

UpdateItem()

UpdateItem ::= IdentificationVariable "." {StateField | SingleValuedAssociationField} "=" NewValue

\Doctrine\ORM\Query\AST\UpdateStatement

UpdateStatement()

UpdateStatement ::= UpdateClause [WhereClause]

\Doctrine\ORM\Query\AST\WhereClause

WhereClause()

WhereClause ::= "WHERE" ConditionalExpression

void

addCustomTreeWalker(string className)

Adds a custom tree walker for modifying the AST.

void

free(boolean deep, integer position)

Free this parser enabling it to be reused

\Doctrine\ORM\Query\AST\SelectStatement

getAST()

Parse and build AST for the given Query.

EntityManager

getEntityManager()

Gets the EntityManager used by the parser.

Doctrine\ORM\Query\Lexer

getLexer()

Gets the lexer used by the parser.

Doctrine\ORM\Query\ParserResult

getParserResult()

Gets the ParserResult that is being filled with information during parsing.

void

match(int|string token)

Attempts to match the given token with the current lookahead token.

ParserResult

parse()

Parses a query string.

void

semanticalError(string message, array token)

Generates a new semantical error.

void

setCustomOutputTreeWalker(string className)

Sets a custom tree walker that produces output.

void

syntaxError(string expected, array token)

Generates a new syntax error.

Constructor Detail

/Doctrine/ORM/Query/Parser.php at line 137

Parser

public Parser(Query query)

Creates a new query parser object.

Parameters:
query - The Query to parse.

Method Detail

/Doctrine/ORM/Query/Parser.php at line 816

AbstractSchemaName

public string AbstractSchemaName()

AbstractSchemaName ::= identifier


/Doctrine/ORM/Query/Parser.php at line 2280

AggregateExpression

public \Doctrine\ORM\Query\AST\AggregateExpression AggregateExpression()

AggregateExpression ::= ("AVG" | "MAX" | "MIN" | "SUM") "(" ["DISTINCT"] StateFieldPathExpression ")" | "COUNT" "(" ["DISTINCT"] (IdentificationVariable | SingleValuedPathExpression) ")"


/Doctrine/ORM/Query/Parser.php at line 795

AliasIdentificationVariable

public string AliasIdentificationVariable()

AliasIdentificationVariable = identifier


/Doctrine/ORM/Query/Parser.php at line 841

AliasResultVariable

public string AliasResultVariable()

AliasResultVariable ::= identifier


/Doctrine/ORM/Query/Parser.php at line 2065

ArithmeticExpression

public \Doctrine\ORM\Query\AST\ArithmeticExpression ArithmeticExpression()

ArithmeticExpression ::= SimpleArithmeticExpression | "(" Subselect ")"


/Doctrine/ORM/Query/Parser.php at line 2131

ArithmeticFactor

public \Doctrine\ORM\Query\AST\ArithmeticFactor ArithmeticFactor()

ArithmeticFactor ::= [("+" | "-")] ArithmeticPrimary


/Doctrine/ORM/Query/Parser.php at line 2148

ArithmeticPrimary

public void ArithmeticPrimary()

ArithmeticPrimary ::= SingleValuedPathExpression | Literal | "(" SimpleArithmeticExpression ")" | FunctionsReturningNumerics | AggregateExpression | FunctionsReturningStrings | FunctionsReturningDatetime | IdentificationVariable


/Doctrine/ORM/Query/Parser.php at line 2111

ArithmeticTerm

public \Doctrine\ORM\Query\AST\ArithmeticTerm ArithmeticTerm()

ArithmeticTerm ::= ArithmeticFactor {("*" | "/") ArithmeticFactor}


/Doctrine/ORM/Query/Parser.php at line 943

AssociationPathExpression

public \Doctrine\ORM\Query\AST\PathExpression AssociationPathExpression()

AssociationPathExpression ::= CollectionValuedPathExpression | SingleValuedAssociationPathExpression


/Doctrine/ORM/Query/Parser.php at line 2354

BetweenExpression

public \Doctrine\ORM\Query\AST\BetweenExpression BetweenExpression()

BetweenExpression ::= ArithmeticExpression ["NOT"] "BETWEEN" ArithmeticExpression "AND" ArithmeticExpression


/Doctrine/ORM/Query/Parser.php at line 1646

CaseExpression

public void CaseExpression()

/Doctrine/ORM/Query/Parser.php at line 1978

CollectionMemberExpression

public \Doctrine\ORM\Query\AST\CollectionMemberExpression CollectionMemberExpression()

CollectionMemberExpression ::= EntityExpression ["NOT"] "MEMBER" ["OF"] CollectionValuedPathExpression

EntityExpression ::= SingleValuedAssociationPathExpression | SimpleEntityExpression SimpleEntityExpression ::= IdentificationVariable | InputParameter


/Doctrine/ORM/Query/Parser.php at line 989

CollectionValuedPathExpression

public \Doctrine\ORM\Query\AST\PathExpression CollectionValuedPathExpression()

CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField


/Doctrine/ORM/Query/Parser.php at line 2380

ComparisonExpression

public \Doctrine\ORM\Query\AST\ComparisonExpression ComparisonExpression()

ComparisonExpression ::= ArithmeticExpression ComparisonOperator ( QuantifiedExpression | ArithmeticExpression )


/Doctrine/ORM/Query/Parser.php at line 2526

ComparisonOperator

public string ComparisonOperator()

ComparisonOperator ::= "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="


/Doctrine/ORM/Query/Parser.php at line 1775

ConditionalExpression

public \Doctrine\ORM\Query\AST\ConditionalExpression ConditionalExpression()

ConditionalExpression ::= ConditionalTerm {"OR" ConditionalTerm}


/Doctrine/ORM/Query/Parser.php at line 1811

ConditionalFactor

public \Doctrine\ORM\Query\AST\ConditionalFactor ConditionalFactor()

ConditionalFactor ::= ["NOT"] ConditionalPrimary


/Doctrine/ORM/Query/Parser.php at line 1831

ConditionalPrimary

public Doctrine\ORM\Query\AST\ConditionalPrimary ConditionalPrimary()

ConditionalPrimary ::= SimpleConditionalExpression | "(" ConditionalExpression ")"


/Doctrine/ORM/Query/Parser.php at line 1793

ConditionalTerm

public \Doctrine\ORM\Query\AST\ConditionalTerm ConditionalTerm()

ConditionalTerm ::= ConditionalFactor {"AND" ConditionalFactor}


/Doctrine/ORM/Query/Parser.php at line 2643

CustomFunctionsReturningDatetime

public void CustomFunctionsReturningDatetime()

/Doctrine/ORM/Query/Parser.php at line 2620

CustomFunctionsReturningNumerics

public void CustomFunctionsReturningNumerics()

/Doctrine/ORM/Query/Parser.php at line 2671

CustomFunctionsReturningStrings

public void CustomFunctionsReturningStrings()

/Doctrine/ORM/Query/Parser.php at line 1111

DeleteClause

public \Doctrine\ORM\Query\AST\DeleteClause DeleteClause()

DeleteClause ::= "DELETE" ["FROM"] AbstractSchemaName ["AS"] AliasIdentificationVariable


/Doctrine/ORM/Query/Parser.php at line 761

DeleteStatement

public \Doctrine\ORM\Query\AST\DeleteStatement DeleteStatement()

DeleteStatement ::= DeleteClause [WhereClause]


/Doctrine/ORM/Query/Parser.php at line 1953

EmptyCollectionComparisonExpression

public \Doctrine\ORM\Query\AST\EmptyCollectionComparisonExpression EmptyCollectionComparisonExpression()

EmptyCollectionComparisonExpression ::= CollectionValuedPathExpression "IS" ["NOT"] "EMPTY"


/Doctrine/ORM/Query/Parser.php at line 2248

EntityExpression

public \Doctrine\ORM\Query\AST\SingleValuedAssociationPathExpression EntityExpression()

EntityExpression ::= SingleValuedAssociationPathExpression | SimpleEntityExpression

Returns:
| \Doctrine\ORM\Query\AST\SimpleEntityExpression

/Doctrine/ORM/Query/Parser.php at line 2503

ExistsExpression

public \Doctrine\ORM\Query\AST\ExistsExpression ExistsExpression()

ExistsExpression ::= ["NOT"] "EXISTS" "(" Subselect ")"


/Doctrine/ORM/Query/Parser.php at line 1150

FromClause

public \Doctrine\ORM\Query\AST\FromClause FromClause()

FromClause ::= "FROM" IdentificationVariableDeclaration {"," IdentificationVariableDeclaration}


/Doctrine/ORM/Query/Parser.php at line 2573

FunctionDeclaration

public void FunctionDeclaration()

FunctionDeclaration ::= FunctionsReturningStrings | FunctionsReturningNumerics | FunctionsReturningDatetime


/Doctrine/ORM/Query/Parser.php at line 2633

FunctionsReturningDatetime

public void FunctionsReturningDatetime()

FunctionsReturningDateTime ::= "CURRENT_DATE" | "CURRENT_TIME" | "CURRENT_TIMESTAMP"


/Doctrine/ORM/Query/Parser.php at line 2610

FunctionsReturningNumerics

public void FunctionsReturningNumerics()

FunctionsReturningNumerics ::= "LENGTH" "(" StringPrimary ")" | "LOCATE" "(" StringPrimary "," StringPrimary ["," SimpleArithmeticExpression]")" | "ABS" "(" SimpleArithmeticExpression ")" | "SQRT" "(" SimpleArithmeticExpression ")" | "MOD" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")" | "SIZE" "(" CollectionValuedPathExpression ")"


/Doctrine/ORM/Query/Parser.php at line 2661

FunctionsReturningStrings

public void FunctionsReturningStrings()

FunctionsReturningStrings ::= "CONCAT" "(" StringPrimary "," StringPrimary ")" | "SUBSTRING" "(" StringPrimary "," SimpleArithmeticExpression "," SimpleArithmeticExpression ")" | "TRIM" "(" [["LEADING" | "TRAILING" | "BOTH"] [char] "FROM"] StringPrimary ")" | "LOWER" "(" StringPrimary ")" | "UPPER" "(" StringPrimary ")"


/Doctrine/ORM/Query/Parser.php at line 1212

GroupByClause

public \Doctrine\ORM\Query\AST\GroupByClause GroupByClause()

GroupByClause ::= "GROUP" "BY" GroupByItem {"," GroupByItem}


/Doctrine/ORM/Query/Parser.php at line 1316

GroupByItem

public string GroupByItem()

GroupByItem ::= IdentificationVariable | SingleValuedPathExpression

Returns:
| \Doctrine\ORM\Query\AST\PathExpression

/Doctrine/ORM/Query/Parser.php at line 1200

HavingClause

public \Doctrine\ORM\Query\AST\HavingClause HavingClause()

HavingClause ::= "HAVING" ConditionalExpression


/Doctrine/ORM/Query/Parser.php at line 775

IdentificationVariable

public string IdentificationVariable()

IdentificationVariable ::= identifier


/Doctrine/ORM/Query/Parser.php at line 1395

IdentificationVariableDeclaration

public \Doctrine\ORM\Query\AST\IdentificationVariableDeclaration IdentificationVariableDeclaration()

IdentificationVariableDeclaration ::= RangeVariableDeclaration [IndexBy] {JoinVariableDeclaration}


/Doctrine/ORM/Query/Parser.php at line 2401

InExpression

public \Doctrine\ORM\Query\AST\InExpression InExpression()

InExpression ::= StateFieldPathExpression ["NOT"] "IN" "(" (InParameter {"," InParameter}* | Subselect) ")"


/Doctrine/ORM/Query/Parser.php at line 2039

InParameter

public string InParameter()

InParameter ::= Literal | InputParameter

Returns:
| \Doctrine\ORM\Query\AST\InputParameter

/Doctrine/ORM/Query/Parser.php at line 1594

IndexBy

public Doctrine\ORM\Query\AST\IndexBy IndexBy()

IndexBy ::= "INDEX" "BY" SimpleStateFieldPathExpression


/Doctrine/ORM/Query/Parser.php at line 2053

InputParameter

public \Doctrine\ORM\Query\AST\InputParameter InputParameter()

InputParameter ::= PositionalParameter | NamedParameter


/Doctrine/ORM/Query/Parser.php at line 1524

Join

public Doctrine\ORM\Query\AST\Join Join()

Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" JoinAssociationPathExpression ["AS"] AliasIdentificationVariable ["WITH" ConditionalExpression]


/Doctrine/ORM/Query/Parser.php at line 883

JoinAssociationPathExpression

public \Doctrine\ORM\Query\AST\JoinAssociationPathExpression JoinAssociationPathExpression()

JoinAssociationPathExpression ::= IdentificationVariable "." (CollectionValuedAssociationField | SingleValuedAssociationField)


/Doctrine/ORM/Query/Parser.php at line 1441

JoinVariableDeclaration

public \Doctrine\ORM\Query\AST\JoinVariableDeclaration JoinVariableDeclaration()

JoinVariableDeclaration ::= Join [IndexBy]


/Doctrine/ORM/Query/Parser.php at line 2437

LikeExpression

public \Doctrine\ORM\Query\AST\LikeExpression LikeExpression()

LikeExpression ::= StringExpression ["NOT"] "LIKE" (string | input_parameter) ["ESCAPE" char]


/Doctrine/ORM/Query/Parser.php at line 2008

Literal

public string Literal()

Literal ::= string | char | integer | float | boolean


/Doctrine/ORM/Query/Parser.php at line 1377

NewValue

public void NewValue()

NewValue ::= SimpleArithmeticExpression | StringPrimary | DatetimePrimary | BooleanPrimary | EnumPrimary | SimpleEntityExpression | "NULL"

NOTE: Since it is not possible to correctly recognize individual types, here is the full grammar that needs to be supported:

NewValue ::= SimpleArithmeticExpression | "NULL"

SimpleArithmeticExpression covers all *Primary grammar rules and also SimplEntityExpression


/Doctrine/ORM/Query/Parser.php at line 2476

NullComparisonExpression

public \Doctrine\ORM\Query\AST\NullComparisonExpression NullComparisonExpression()

NullComparisonExpression ::= (SingleValuedPathExpression | InputParameter) "IS" ["NOT"] "NULL"


/Doctrine/ORM/Query/Parser.php at line 1232

OrderByClause

public \Doctrine\ORM\Query\AST\OrderByClause OrderByClause()

OrderByClause ::= "ORDER" "BY" OrderByItem {"," OrderByItem}


/Doctrine/ORM/Query/Parser.php at line 1339

OrderByItem

public \Doctrine\ORM\Query\AST\OrderByItem OrderByItem()

OrderByItem ::= (ResultVariable | StateFieldPathExpression) ["ASC" | "DESC"]

Todo:
Post 2.0 release. Support general SingleValuedPathExpression instead of only StateFieldPathExpression.

/Doctrine/ORM/Query/Parser.php at line 1487

PartialObjectExpression

public array PartialObjectExpression()

PartialObjectExpression ::= "PARTIAL" IdentificationVariable "." PartialFieldSet PartialFieldSet ::= "{" SimpleStateField {"," SimpleStateField}* "}"


/Doctrine/ORM/Query/Parser.php at line 912

PathExpression

public \Doctrine\ORM\Query\AST\PathExpression PathExpression(integer expectedTypes)

Parses an arbitrary path expression and defers semantical validation based on expected types.

PathExpression ::= IdentificationVariable {"." identifier}* "." identifier


/Doctrine/ORM/Query/Parser.php at line 2324

QuantifiedExpression

public \Doctrine\ORM\Query\AST\QuantifiedExpression QuantifiedExpression()

QuantifiedExpression ::= ("ALL" | "ANY" | "SOME") "(" Subselect ")"


/Doctrine/ORM/Query/Parser.php at line 691

QueryLanguage

public \Doctrine\ORM\Query\AST\SelectStatement QueryLanguage()

QueryLanguage ::= SelectStatement | UpdateStatement | DeleteStatement

Returns:
| \Doctrine\ORM\Query\AST\UpdateStatement | \Doctrine\ORM\Query\AST\DeleteStatement

/Doctrine/ORM/Query/Parser.php at line 1455

RangeVariableDeclaration

public Doctrine\ORM\Query\AST\RangeVariableDeclaration RangeVariableDeclaration()

RangeVariableDeclaration ::= AbstractSchemaName ["AS"] AliasIdentificationVariable


/Doctrine/ORM/Query/Parser.php at line 862

ResultVariable

public string ResultVariable()

ResultVariable ::= identifier


/Doctrine/ORM/Query/Parser.php at line 1614

ScalarExpression

public mixed ScalarExpression()

ScalarExpression ::= SimpleArithmeticExpression | StringPrimary | DateTimePrimary | StateFieldPathExpression | BooleanPrimary | CaseExpression | EntityTypeExpression

Returns:
One of the possible expressions or subexpressions.

/Doctrine/ORM/Query/Parser.php at line 1019

SelectClause

public \Doctrine\ORM\Query\AST\SelectClause SelectClause()

SelectClause ::= "SELECT" ["DISTINCT"] SelectExpression {"," SelectExpression}


/Doctrine/ORM/Query/Parser.php at line 1662

SelectExpression

public Doctrine\ORM\Query\AST\SelectExpression SelectExpression()

SelectExpression ::= IdentificationVariable | StateFieldPathExpression | (AggregateExpression | "(" Subselect ")" | ScalarExpression) [["AS"] AliasResultVariable]


/Doctrine/ORM/Query/Parser.php at line 723

SelectStatement

public \Doctrine\ORM\Query\AST\SelectStatement SelectStatement()

SelectStatement ::= SelectClause FromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause]


/Doctrine/ORM/Query/Parser.php at line 2091

SimpleArithmeticExpression

public \Doctrine\ORM\Query\AST\SimpleArithmeticExpression SimpleArithmeticExpression()

SimpleArithmeticExpression ::= ArithmeticTerm {("+" | "-") ArithmeticTerm}


/Doctrine/ORM/Query/Parser.php at line 1865

SimpleConditionalExpression

public void SimpleConditionalExpression()

SimpleConditionalExpression ::= ComparisonExpression | BetweenExpression | LikeExpression | InExpression | NullComparisonExpression | ExistsExpression | EmptyCollectionComparisonExpression | CollectionMemberExpression


/Doctrine/ORM/Query/Parser.php at line 2264

SimpleEntityExpression

public string SimpleEntityExpression()

SimpleEntityExpression ::= IdentificationVariable | InputParameter

Returns:
| \Doctrine\ORM\Query\AST\InputParameter

/Doctrine/ORM/Query/Parser.php at line 1047

SimpleSelectClause

public \Doctrine\ORM\Query\AST\SimpleSelectClause SimpleSelectClause()

SimpleSelectClause ::= "SELECT" ["DISTINCT"] SimpleSelectExpression


/Doctrine/ORM/Query/Parser.php at line 1733

SimpleSelectExpression

public \Doctrine\ORM\Query\AST\SimpleSelectExpression SimpleSelectExpression()

SimpleSelectExpression ::= StateFieldPathExpression | IdentificationVariable | (AggregateExpression [["AS"] AliasResultVariable])


/Doctrine/ORM/Query/Parser.php at line 999

SimpleStateFieldPathExpression

public \Doctrine\ORM\Query\AST\PathExpression SimpleStateFieldPathExpression()

SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField


/Doctrine/ORM/Query/Parser.php at line 979

SingleValuedAssociationPathExpression

public \Doctrine\ORM\Query\AST\PathExpression SingleValuedAssociationPathExpression()

SingleValuedAssociationPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* SingleValuedAssociationField


/Doctrine/ORM/Query/Parser.php at line 956

SingleValuedPathExpression

public \Doctrine\ORM\Query\AST\PathExpression SingleValuedPathExpression()

SingleValuedPathExpression ::= StateFieldPathExpression | SingleValuedAssociationPathExpression


/Doctrine/ORM/Query/Parser.php at line 969

StateFieldPathExpression

public \Doctrine\ORM\Query\AST\PathExpression StateFieldPathExpression()

StateFieldPathExpression ::= SimpleStateFieldPathExpression | SimpleStateFieldAssociationPathExpression


/Doctrine/ORM/Query/Parser.php at line 2197

StringExpression

public \Doctrine\ORM\Query\AST\StringPrimary StringExpression()

StringExpression ::= StringPrimary | "(" Subselect ")"

Returns:
| \Doctrine]ORM\Query\AST\Subselect

/Doctrine/ORM/Query/Parser.php at line 2217

StringPrimary

public void StringPrimary()

StringPrimary ::= StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression


/Doctrine/ORM/Query/Parser.php at line 1253

Subselect

public \Doctrine\ORM\Query\AST\Subselect Subselect()

Subselect ::= SimpleSelectClause SubselectFromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause]


/Doctrine/ORM/Query/Parser.php at line 1169

SubselectFromClause

public \Doctrine\ORM\Query\AST\SubselectFromClause SubselectFromClause()

SubselectFromClause ::= "FROM" SubselectIdentificationVariableDeclaration {"," SubselectIdentificationVariableDeclaration}


/Doctrine/ORM/Query/Parser.php at line 1420

SubselectIdentificationVariableDeclaration

public \Doctrine\ORM\Query\AST\SubselectIdentificationVariableDeclaration SubselectIdentificationVariableDeclaration()

SubselectIdentificationVariableDeclaration ::= IdentificationVariableDeclaration | (AssociationPathExpression ["AS"] AliasIdentificationVariable)

Returns:
| \Doctrine\ORM\Query\AST\IdentificationVariableDeclaration

/Doctrine/ORM/Query/Parser.php at line 1065

UpdateClause

public \Doctrine\ORM\Query\AST\UpdateClause UpdateClause()

UpdateClause ::= "UPDATE" AbstractSchemaName ["AS"] AliasIdentificationVariable "SET" UpdateItem {"," UpdateItem}


/Doctrine/ORM/Query/Parser.php at line 1283

UpdateItem

public \Doctrine\ORM\Query\AST\UpdateItem UpdateItem()

UpdateItem ::= IdentificationVariable "." {StateField | SingleValuedAssociationField} "=" NewValue


/Doctrine/ORM/Query/Parser.php at line 747

UpdateStatement

public \Doctrine\ORM\Query\AST\UpdateStatement UpdateStatement()

UpdateStatement ::= UpdateClause [WhereClause]


/Doctrine/ORM/Query/Parser.php at line 1188

WhereClause

public \Doctrine\ORM\Query\AST\WhereClause WhereClause()

WhereClause ::= "WHERE" ConditionalExpression


/Doctrine/ORM/Query/Parser.php at line 161

addCustomTreeWalker

public void addCustomTreeWalker(string className)

Adds a custom tree walker for modifying the AST.


/Doctrine/ORM/Query/Parser.php at line 249

free

public void free(boolean deep, integer position)

Free this parser enabling it to be reused

Parameters:
deep - Whether to clean peek and reset errors
position - Position to reset

/Doctrine/ORM/Query/Parser.php at line 203

getAST

public \Doctrine\ORM\Query\AST\SelectStatement getAST()

Parse and build AST for the given Query.

Returns:
| \Doctrine\ORM\Query\AST\UpdateStatement | \Doctrine\ORM\Query\AST\DeleteStatement

/Doctrine/ORM/Query/Parser.php at line 191

getEntityManager

public EntityManager getEntityManager()

Gets the EntityManager used by the parser.


/Doctrine/ORM/Query/Parser.php at line 171

getLexer

public Doctrine\ORM\Query\Lexer getLexer()

Gets the lexer used by the parser.


/Doctrine/ORM/Query/Parser.php at line 181

getParserResult

public Doctrine\ORM\Query\ParserResult getParserResult()

Gets the ParserResult that is being filled with information during parsing.


/Doctrine/ORM/Query/Parser.php at line 234

match

public void match(int|string token)

Attempts to match the given token with the current lookahead token.

If they match, updates the lookahead token; otherwise raises a syntax error.

Parameters:
token - type or value
Throws:
If the tokens dont match.

/Doctrine/ORM/Query/Parser.php at line 268

parse

public ParserResult parse()

Parses a query string.


/Doctrine/ORM/Query/Parser.php at line 353

semanticalError

public void semanticalError(string message, array token)

Generates a new semantical error.

Parameters:
message - Optional message.
token - Optional token.
Throws:
\Doctrine\ORM\Query\QueryException

/Doctrine/ORM/Query/Parser.php at line 151

setCustomOutputTreeWalker

public void setCustomOutputTreeWalker(string className)

Sets a custom tree walker that produces output. This tree walker will be run last over the AST, after any other walkers.


/Doctrine/ORM/Query/Parser.php at line 321

syntaxError

public void syntaxError(string expected, array token)

Generates a new syntax error.

Parameters:
expected - Expected string.
token - Got token.
Throws:
\Doctrine\ORM\Query\QueryException

Doctrine