TreeWalkerChain
in package
implements
TreeWalker
Represents a chain of tree walkers that modify an AST and finally emit output.
Only the last walker in the chain can emit output. Any previous walkers can modify the AST to influence the final output produced by the last walker.
Tags
Table of Contents
Interfaces
- TreeWalker
- Interface for walkers of DQL ASTs (abstract syntax trees).
Properties
- $parserResult : ParserResult
- $query : AbstractQuery
- $queryComponents : array<string, array<string, mixed>>
- The query components of the original query (the "symbol table") that was produced by the Parser.
- $walkers : array<string|int, string>
- The tree walkers.
Methods
- __construct() : mixed
- Initializes TreeWalker with important information about the ASTs to be walked.
- addTreeWalker() : void
- Adds a tree walker to the chain.
- getExecutor() : AbstractSqlExecutor
- Gets an executor that can be used to execute the result of this walker.
- getQueryComponents() : array<string, array<string, mixed>>
- Returns the internal queryComponents array.
- setQueryComponent() : void
- Sets or overrides a query component for a given dql alias.
- walkAggregateExpression() : void
- Walks down an AggregateExpression AST node.
- walkArithmeticExpression() : void
- Walks down an ArithmeticExpression AST node.
- walkArithmeticFactor() : void
- Walks down an ArithmeticFactor that represents an AST node.
- walkArithmeticTerm() : void
- Walks down an ArithmeticTerm AST node.
- walkBetweenExpression() : void
- Walks down a BetweenExpression AST node.
- walkCollectionMemberExpression() : void
- Walks down a CollectionMemberExpression AST node.
- walkComparisonExpression() : void
- Walks down a ComparisonExpression AST node.
- walkConditionalExpression() : void
- Walk down a ConditionalExpression AST node.
- walkConditionalFactor() : void
- Walks down a ConditionalFactor AST node.
- walkConditionalPrimary() : void
- Walks down a ConditionalPrimary AST node.
- walkConditionalTerm() : void
- Walks down a ConditionalTerm AST node.
- walkDeleteClause() : void
- Walks down a DeleteClause AST node.
- walkDeleteStatement() : void
- Walks down a DeleteStatement AST node.
- walkEmptyCollectionComparisonExpression() : void
- Walks down an EmptyCollectionComparisonExpression AST node.
- walkExistsExpression() : void
- Walks down an ExistsExpression AST node.
- walkFromClause() : void
- Walks down a FromClause AST node.
- walkFunction() : void
- Walks down a FunctionNode AST node.
- walkGroupByClause() : void
- Walks down a GroupByClause AST node.
- walkGroupByItem() : void
- Walks down a GroupByItem AST node.
- walkHavingClause() : void
- Walks down a HavingClause AST node.
- walkInExpression() : void
- Walks down an InExpression AST node.
- walkInputParameter() : void
- Walks down an InputParameter AST node.
- walkInstanceOfExpression() : void
- Walks down an InstanceOfExpression AST node.
- walkJoin() : void
- Walks down a Join AST node.
- walkLikeExpression() : void
- Walks down a LikeExpression AST node.
- walkLiteral() : void
- Walks down a literal that represents an AST node.
- walkNullComparisonExpression() : void
- Walks down a NullComparisonExpression AST node.
- walkOrderByClause() : void
- Walks down an OrderByClause AST node.
- walkOrderByItem() : void
- Walks down an OrderByItem AST node, thereby generating the appropriate SQL.
- walkPathExpression() : void
- Walks down a PathExpression AST node.
- walkQuantifiedExpression() : void
- Walks down a QuantifiedExpression AST node.
- walkResultVariable() : void
- Walks down a ResultVariable that represents an AST node.
- walkSelectClause() : void
- Walks down a SelectClause AST node.
- walkSelectExpression() : void
- Walks down a SelectExpression AST node.
- walkSelectStatement() : void
- Walks down a SelectStatement AST node.
- walkSimpleArithmeticExpression() : void
- Walks down an SimpleArithmeticExpression AST node.
- walkSimpleSelectClause() : void
- Walks down a SimpleSelectClause AST node.
- walkSimpleSelectExpression() : void
- Walks down a SimpleSelectExpression AST node.
- walkStateFieldPathExpression() : void
- Walks down a StateFieldPathExpression AST node.
- walkStringPrimary() : void
- Walks down a StringPrimary that represents an AST node.
- walkSubselect() : void
- Walks down a Subselect AST node.
- walkSubselectFromClause() : void
- Walks down a SubselectFromClause AST node.
- walkUpdateClause() : void
- Walks down an UpdateClause AST node.
- walkUpdateItem() : void
- Walks down an UpdateItem AST node.
- walkUpdateStatement() : void
- Walks down an UpdateStatement AST node.
- walkWhereClause() : void
- Walks down a WhereClause AST node.
- getWalkers() : Generator
Properties
$parserResult
private
ParserResult
$parserResult
$query
private
AbstractQuery
$query
$queryComponents
The query components of the original query (the "symbol table") that was produced by the Parser.
private
array<string, array<string, mixed>>
$queryComponents
Tags
$walkers
The tree walkers.
private
array<string|int, string>
$walkers
= []
Tags
Methods
__construct()
Initializes TreeWalker with important information about the ASTs to be walked.
public
__construct(mixed $query, mixed $parserResult, array<string|int, mixed> $queryComponents) : mixed
Parameters
- $query : mixed
-
The parsed Query.
- $parserResult : mixed
-
The result of the parsing process.
- $queryComponents : array<string|int, mixed>
-
The query components (symbol table).
addTreeWalker()
Adds a tree walker to the chain.
public
addTreeWalker(string $walkerClass) : void
Parameters
- $walkerClass : string
-
The class of the walker to instantiate.
Tags
getExecutor()
Gets an executor that can be used to execute the result of this walker.
public
getExecutor(mixed $AST) : AbstractSqlExecutor
Parameters
- $AST : mixed
Tags
Return values
AbstractSqlExecutorgetQueryComponents()
Returns the internal queryComponents array.
public
getQueryComponents() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>setQueryComponent()
Sets or overrides a query component for a given dql alias.
public
setQueryComponent(mixed $dqlAlias, array<string|int, mixed> $queryComponent) : void
Parameters
- $dqlAlias : mixed
-
The DQL alias.
- $queryComponent : array<string|int, mixed>
walkAggregateExpression()
Walks down an AggregateExpression AST node.
public
walkAggregateExpression(mixed $aggExpression) : void
Parameters
- $aggExpression : mixed
Tags
walkArithmeticExpression()
Walks down an ArithmeticExpression AST node.
public
walkArithmeticExpression(mixed $arithmeticExpr) : void
Parameters
- $arithmeticExpr : mixed
Tags
walkArithmeticFactor()
Walks down an ArithmeticFactor that represents an AST node.
public
walkArithmeticFactor(mixed $factor) : void
Parameters
- $factor : mixed
Tags
walkArithmeticTerm()
Walks down an ArithmeticTerm AST node.
public
walkArithmeticTerm(mixed $term) : void
Parameters
- $term : mixed
Tags
walkBetweenExpression()
Walks down a BetweenExpression AST node.
public
walkBetweenExpression(mixed $betweenExpr) : void
Parameters
- $betweenExpr : mixed
Tags
walkCollectionMemberExpression()
Walks down a CollectionMemberExpression AST node.
public
walkCollectionMemberExpression(mixed $collMemberExpr) : void
Parameters
- $collMemberExpr : mixed
Tags
walkComparisonExpression()
Walks down a ComparisonExpression AST node.
public
walkComparisonExpression(mixed $compExpr) : void
Parameters
- $compExpr : mixed
Tags
walkConditionalExpression()
Walk down a ConditionalExpression AST node.
public
walkConditionalExpression(mixed $condExpr) : void
Parameters
- $condExpr : mixed
Tags
walkConditionalFactor()
Walks down a ConditionalFactor AST node.
public
walkConditionalFactor(mixed $factor) : void
Parameters
- $factor : mixed
Tags
walkConditionalPrimary()
Walks down a ConditionalPrimary AST node.
public
walkConditionalPrimary(mixed $condPrimary) : void
Parameters
- $condPrimary : mixed
Tags
walkConditionalTerm()
Walks down a ConditionalTerm AST node.
public
walkConditionalTerm(mixed $condTerm) : void
Parameters
- $condTerm : mixed
Tags
walkDeleteClause()
Walks down a DeleteClause AST node.
public
walkDeleteClause(DeleteClause $deleteClause) : void
Parameters
- $deleteClause : DeleteClause
Tags
walkDeleteStatement()
Walks down a DeleteStatement AST node.
public
walkDeleteStatement(DeleteStatement $AST) : void
Parameters
- $AST : DeleteStatement
walkEmptyCollectionComparisonExpression()
Walks down an EmptyCollectionComparisonExpression AST node.
public
walkEmptyCollectionComparisonExpression(mixed $emptyCollCompExpr) : void
Parameters
- $emptyCollCompExpr : mixed
Tags
walkExistsExpression()
Walks down an ExistsExpression AST node.
public
walkExistsExpression(mixed $existsExpr) : void
Parameters
- $existsExpr : mixed
Tags
walkFromClause()
Walks down a FromClause AST node.
public
walkFromClause(mixed $fromClause) : void
Parameters
- $fromClause : mixed
Tags
walkFunction()
Walks down a FunctionNode AST node.
public
walkFunction(mixed $function) : void
Parameters
- $function : mixed
Tags
walkGroupByClause()
Walks down a GroupByClause AST node.
public
walkGroupByClause(mixed $groupByClause) : void
Parameters
- $groupByClause : mixed
Tags
walkGroupByItem()
Walks down a GroupByItem AST node.
public
walkGroupByItem(mixed $groupByItem) : void
Parameters
- $groupByItem : mixed
Tags
walkHavingClause()
Walks down a HavingClause AST node.
public
walkHavingClause(mixed $havingClause) : void
Parameters
- $havingClause : mixed
Tags
walkInExpression()
Walks down an InExpression AST node.
public
walkInExpression(mixed $inExpr) : void
Parameters
- $inExpr : mixed
Tags
walkInputParameter()
Walks down an InputParameter AST node.
public
walkInputParameter(mixed $inputParam) : void
Parameters
- $inputParam : mixed
Tags
walkInstanceOfExpression()
Walks down an InstanceOfExpression AST node.
public
walkInstanceOfExpression(mixed $instanceOfExpr) : void
Parameters
- $instanceOfExpr : mixed
Tags
walkJoin()
Walks down a Join AST node.
public
walkJoin(mixed $join) : void
Parameters
- $join : mixed
Tags
walkLikeExpression()
Walks down a LikeExpression AST node.
public
walkLikeExpression(mixed $likeExpr) : void
Parameters
- $likeExpr : mixed
Tags
walkLiteral()
Walks down a literal that represents an AST node.
public
walkLiteral(mixed $literal) : void
Parameters
- $literal : mixed
Tags
walkNullComparisonExpression()
Walks down a NullComparisonExpression AST node.
public
walkNullComparisonExpression(mixed $nullCompExpr) : void
Parameters
- $nullCompExpr : mixed
Tags
walkOrderByClause()
Walks down an OrderByClause AST node.
public
walkOrderByClause(mixed $orderByClause) : void
Parameters
- $orderByClause : mixed
Tags
walkOrderByItem()
Walks down an OrderByItem AST node, thereby generating the appropriate SQL.
public
walkOrderByItem(mixed $orderByItem) : void
Parameters
- $orderByItem : mixed
Tags
walkPathExpression()
Walks down a PathExpression AST node.
public
walkPathExpression(mixed $pathExpr) : void
Parameters
- $pathExpr : mixed
Tags
walkQuantifiedExpression()
Walks down a QuantifiedExpression AST node.
public
walkQuantifiedExpression(mixed $qExpr) : void
Parameters
- $qExpr : mixed
Tags
walkResultVariable()
Walks down a ResultVariable that represents an AST node.
public
walkResultVariable(mixed $resultVariable) : void
Parameters
- $resultVariable : mixed
Tags
walkSelectClause()
Walks down a SelectClause AST node.
public
walkSelectClause(mixed $selectClause) : void
Parameters
- $selectClause : mixed
Tags
walkSelectExpression()
Walks down a SelectExpression AST node.
public
walkSelectExpression(mixed $selectExpression) : void
Parameters
- $selectExpression : mixed
Tags
walkSelectStatement()
Walks down a SelectStatement AST node.
public
walkSelectStatement(SelectStatement $AST) : void
Parameters
- $AST : SelectStatement
walkSimpleArithmeticExpression()
Walks down an SimpleArithmeticExpression AST node.
public
walkSimpleArithmeticExpression(mixed $simpleArithmeticExpr) : void
Parameters
- $simpleArithmeticExpr : mixed
Tags
walkSimpleSelectClause()
Walks down a SimpleSelectClause AST node.
public
walkSimpleSelectClause(mixed $simpleSelectClause) : void
Parameters
- $simpleSelectClause : mixed
Tags
walkSimpleSelectExpression()
Walks down a SimpleSelectExpression AST node.
public
walkSimpleSelectExpression(mixed $simpleSelectExpression) : void
Parameters
- $simpleSelectExpression : mixed
Tags
walkStateFieldPathExpression()
Walks down a StateFieldPathExpression AST node.
public
walkStateFieldPathExpression(mixed $stateFieldPathExpression) : void
Parameters
- $stateFieldPathExpression : mixed
Tags
walkStringPrimary()
Walks down a StringPrimary that represents an AST node.
public
walkStringPrimary(mixed $stringPrimary) : void
Parameters
- $stringPrimary : mixed
Tags
walkSubselect()
Walks down a Subselect AST node.
public
walkSubselect(mixed $subselect) : void
Parameters
- $subselect : mixed
Tags
walkSubselectFromClause()
Walks down a SubselectFromClause AST node.
public
walkSubselectFromClause(mixed $subselectFromClause) : void
Parameters
- $subselectFromClause : mixed
Tags
walkUpdateClause()
Walks down an UpdateClause AST node.
public
walkUpdateClause(mixed $updateClause) : void
Parameters
- $updateClause : mixed
Tags
walkUpdateItem()
Walks down an UpdateItem AST node.
public
walkUpdateItem(mixed $updateItem) : void
Parameters
- $updateItem : mixed
Tags
walkUpdateStatement()
Walks down an UpdateStatement AST node.
public
walkUpdateStatement(UpdateStatement $AST) : void
Parameters
- $AST : UpdateStatement
walkWhereClause()
Walks down a WhereClause AST node.
public
walkWhereClause(mixed $whereClause) : void
Parameters
- $whereClause : mixed
Tags
getWalkers()
private
getWalkers() : Generator