class CountWalker extends TreeWalkerAdapter (View source)

Replaces the selectClause of the AST with a COUNT statement.

Constants

HINT_DISTINCT

Distinct mode hint name.

Methods

__construct(AbstractQuery $query, ParserResult $parserResult, array $queryComponents)

Initializes TreeWalker with important information about the ASTs to be walked.

array
getQueryComponents()

Returns internal queryComponents array.

void
setQueryComponent(string $dqlAlias, array $queryComponent)

Sets or overrides a query component for a given dql alias.

array
_getQueryComponents()

No description

_getQuery()

Retrieves the Query Instance responsible for the current walkers execution.

_getParserResult()

Retrieves the ParserResult.

string
walkSelectStatement(SelectStatement $AST)

Walks down a SelectStatement AST node, modifying it to retrieve a COUNT.

string
walkSelectClause(SelectClause $selectClause)

Walks down a SelectClause AST node, thereby generating the appropriate SQL.

string
walkFromClause(FromClause $fromClause)

Walks down a FromClause AST node, thereby generating the appropriate SQL.

string
walkFunction(FunctionNode $function)

Walks down a FunctionNode AST node, thereby generating the appropriate SQL.

string
walkOrderByClause(OrderByClause $orderByClause)

Walks down an OrderByClause AST node, thereby generating the appropriate SQL.

string
walkOrderByItem(OrderByItem $orderByItem)

Walks down an OrderByItem AST node, thereby generating the appropriate SQL.

string
walkHavingClause(HavingClause $havingClause)

Walks down a HavingClause AST node, thereby generating the appropriate SQL.

string
walkJoin(Join $join)

Walks down a Join AST node and creates the corresponding SQL.

string
walkSelectExpression(SelectExpression $selectExpression)

Walks down a SelectExpression AST node and generates the corresponding SQL.

string
walkQuantifiedExpression(QuantifiedExpression $qExpr)

Walks down a QuantifiedExpression AST node, thereby generating the appropriate SQL.

string
walkSubselect(Subselect $subselect)

Walks down a Subselect AST node, thereby generating the appropriate SQL.

string
walkSubselectFromClause(SubselectFromClause $subselectFromClause)

Walks down a SubselectFromClause AST node, thereby generating the appropriate SQL.

string
walkSimpleSelectClause(SimpleSelectClause $simpleSelectClause)

Walks down a SimpleSelectClause AST node, thereby generating the appropriate SQL.

string
walkSimpleSelectExpression(SimpleSelectExpression $simpleSelectExpression)

Walks down a SimpleSelectExpression AST node, thereby generating the appropriate SQL.

string
walkAggregateExpression(AggregateExpression $aggExpression)

Walks down an AggregateExpression AST node, thereby generating the appropriate SQL.

string
walkGroupByClause(GroupByClause $groupByClause)

Walks down a GroupByClause AST node, thereby generating the appropriate SQL.

string
walkGroupByItem(PathExpression|string $groupByItem)

Walks down a GroupByItem AST node, thereby generating the appropriate SQL.

string
walkUpdateStatement(UpdateStatement $AST)

Walks down an UpdateStatement AST node, thereby generating the appropriate SQL.

string
walkDeleteStatement(DeleteStatement $AST)

Walks down a DeleteStatement AST node, thereby generating the appropriate SQL.

string
walkDeleteClause(DeleteClause $deleteClause)

Walks down a DeleteClause AST node, thereby generating the appropriate SQL.

string
walkUpdateClause(UpdateClause $updateClause)

Walks down an UpdateClause AST node, thereby generating the appropriate SQL.

string
walkUpdateItem(UpdateItem $updateItem)

Walks down an UpdateItem AST node, thereby generating the appropriate SQL.

string
walkWhereClause(WhereClause $whereClause)

Walks down a WhereClause AST node, thereby generating the appropriate SQL.

string
walkConditionalExpression(ConditionalExpression $condExpr)

Walk down a ConditionalExpression AST node, thereby generating the appropriate SQL.

string
walkConditionalTerm(ConditionalTerm $condTerm)

Walks down a ConditionalTerm AST node, thereby generating the appropriate SQL.

string
walkConditionalFactor(ConditionalFactor $factor)

Walks down a ConditionalFactor AST node, thereby generating the appropriate SQL.

string
walkConditionalPrimary(ConditionalPrimary $primary)

Walks down a ConditionalPrimary AST node, thereby generating the appropriate SQL.

string
walkExistsExpression(ExistsExpression $existsExpr)

Walks down an ExistsExpression AST node, thereby generating the appropriate SQL.

string
walkCollectionMemberExpression(CollectionMemberExpression $collMemberExpr)

Walks down a CollectionMemberExpression AST node, thereby generating the appropriate SQL.

string
walkEmptyCollectionComparisonExpression(EmptyCollectionComparisonExpression $emptyCollCompExpr)

Walks down an EmptyCollectionComparisonExpression AST node, thereby generating the appropriate SQL.

string
walkNullComparisonExpression(NullComparisonExpression $nullCompExpr)

Walks down a NullComparisonExpression AST node, thereby generating the appropriate SQL.

string
walkInExpression(InExpression $inExpr)

Walks down an InExpression AST node, thereby generating the appropriate SQL.

string
walkInstanceOfExpression(InstanceOfExpression $instanceOfExpr)

Walks down an InstanceOfExpression AST node, thereby generating the appropriate SQL.

string
walkLiteral(mixed $literal)

Walks down a literal that represents an AST node, thereby generating the appropriate SQL.

string
walkBetweenExpression(BetweenExpression $betweenExpr)

Walks down a BetweenExpression AST node, thereby generating the appropriate SQL.

string
walkLikeExpression(LikeExpression $likeExpr)

Walks down a LikeExpression AST node, thereby generating the appropriate SQL.

string
walkStateFieldPathExpression(PathExpression $stateFieldPathExpression)

Walks down a StateFieldPathExpression AST node, thereby generating the appropriate SQL.

string
walkComparisonExpression(ComparisonExpression $compExpr)

Walks down a ComparisonExpression AST node, thereby generating the appropriate SQL.

string
walkInputParameter(InputParameter $inputParam)

Walks down an InputParameter AST node, thereby generating the appropriate SQL.

string
walkArithmeticExpression(ArithmeticExpression $arithmeticExpr)

Walks down an ArithmeticExpression AST node, thereby generating the appropriate SQL.

string
walkArithmeticTerm(mixed $term)

Walks down an ArithmeticTerm AST node, thereby generating the appropriate SQL.

string
walkStringPrimary(mixed $stringPrimary)

Walks down a StringPrimary that represents an AST node, thereby generating the appropriate SQL.

string
walkArithmeticFactor(mixed $factor)

Walks down an ArithmeticFactor that represents an AST node, thereby generating the appropriate SQL.

string
walkSimpleArithmeticExpression(SimpleArithmeticExpression $simpleArithmeticExpr)

Walks down an SimpleArithmeticExpression AST node, thereby generating the appropriate SQL.

string
walkPathExpression(mixed $pathExpr)

Walks down a PathExpression AST node, thereby generating the appropriate SQL.

string
walkResultVariable(string $resultVariable)

Walks down a ResultVariable that represents an AST node, thereby generating the appropriate SQL.

getExecutor(DeleteStatement|UpdateStatement|SelectStatement $AST)

Gets an executor that can be used to execute the result of this walker.

Details

__construct(AbstractQuery $query, ParserResult $parserResult, array $queryComponents)

Initializes TreeWalker with important information about the ASTs to be walked.

Parameters

AbstractQuery $query The parsed Query.
ParserResult $parserResult The result of the parsing process.
array $queryComponents The query components (symbol table).

array getQueryComponents()

Returns internal queryComponents array.

Return Value

array

void setQueryComponent(string $dqlAlias, array $queryComponent)

Sets or overrides a query component for a given dql alias.

Parameters

string $dqlAlias The DQL alias.
array $queryComponent

Return Value

void

protected array _getQueryComponents()

Return Value

array

protected AbstractQuery _getQuery()

Retrieves the Query Instance responsible for the current walkers execution.

Return Value

AbstractQuery

protected ParserResult _getParserResult()

Retrieves the ParserResult.

Return Value

ParserResult

string walkSelectStatement(SelectStatement $AST)

Walks down a SelectStatement AST node, modifying it to retrieve a COUNT.

Parameters

SelectStatement $AST

Return Value

string The SQL.

Exceptions

RuntimeException

string walkSelectClause(SelectClause $selectClause)

Walks down a SelectClause AST node, thereby generating the appropriate SQL.

Parameters

SelectClause $selectClause

Return Value

string The SQL.

string walkFromClause(FromClause $fromClause)

Walks down a FromClause AST node, thereby generating the appropriate SQL.

Parameters

FromClause $fromClause

Return Value

string The SQL.

string walkFunction(FunctionNode $function)

Walks down a FunctionNode AST node, thereby generating the appropriate SQL.

Parameters

FunctionNode $function

Return Value

string The SQL.

string walkOrderByClause(OrderByClause $orderByClause)

Walks down an OrderByClause AST node, thereby generating the appropriate SQL.

Parameters

OrderByClause $orderByClause

Return Value

string The SQL.

string walkOrderByItem(OrderByItem $orderByItem)

Walks down an OrderByItem AST node, thereby generating the appropriate SQL.

Parameters

OrderByItem $orderByItem

Return Value

string The SQL.

string walkHavingClause(HavingClause $havingClause)

Walks down a HavingClause AST node, thereby generating the appropriate SQL.

Parameters

HavingClause $havingClause

Return Value

string The SQL.

string walkJoin(Join $join)

Walks down a Join AST node and creates the corresponding SQL.

Parameters

Join $join

Return Value

string The SQL.

string walkSelectExpression(SelectExpression $selectExpression)

Walks down a SelectExpression AST node and generates the corresponding SQL.

Parameters

SelectExpression $selectExpression

Return Value

string The SQL.

string walkQuantifiedExpression(QuantifiedExpression $qExpr)

Walks down a QuantifiedExpression AST node, thereby generating the appropriate SQL.

Parameters

QuantifiedExpression $qExpr

Return Value

string The SQL.

string walkSubselect(Subselect $subselect)

Walks down a Subselect AST node, thereby generating the appropriate SQL.

Parameters

Subselect $subselect

Return Value

string The SQL.

string walkSubselectFromClause(SubselectFromClause $subselectFromClause)

Walks down a SubselectFromClause AST node, thereby generating the appropriate SQL.

Parameters

SubselectFromClause $subselectFromClause

Return Value

string The SQL.

string walkSimpleSelectClause(SimpleSelectClause $simpleSelectClause)

Walks down a SimpleSelectClause AST node, thereby generating the appropriate SQL.

Parameters

SimpleSelectClause $simpleSelectClause

Return Value

string The SQL.

string walkSimpleSelectExpression(SimpleSelectExpression $simpleSelectExpression)

Walks down a SimpleSelectExpression AST node, thereby generating the appropriate SQL.

Parameters

SimpleSelectExpression $simpleSelectExpression

Return Value

string The SQL.

string walkAggregateExpression(AggregateExpression $aggExpression)

Walks down an AggregateExpression AST node, thereby generating the appropriate SQL.

Parameters

AggregateExpression $aggExpression

Return Value

string The SQL.

string walkGroupByClause(GroupByClause $groupByClause)

Walks down a GroupByClause AST node, thereby generating the appropriate SQL.

Parameters

GroupByClause $groupByClause

Return Value

string The SQL.

string walkGroupByItem(PathExpression|string $groupByItem)

Walks down a GroupByItem AST node, thereby generating the appropriate SQL.

Parameters

PathExpression|string $groupByItem

Return Value

string The SQL.

string walkUpdateStatement(UpdateStatement $AST)

Walks down an UpdateStatement AST node, thereby generating the appropriate SQL.

Parameters

UpdateStatement $AST

Return Value

string The SQL.

string walkDeleteStatement(DeleteStatement $AST)

Walks down a DeleteStatement AST node, thereby generating the appropriate SQL.

Parameters

DeleteStatement $AST

Return Value

string The SQL.

string walkDeleteClause(DeleteClause $deleteClause)

Walks down a DeleteClause AST node, thereby generating the appropriate SQL.

Parameters

DeleteClause $deleteClause

Return Value

string The SQL.

string walkUpdateClause(UpdateClause $updateClause)

Walks down an UpdateClause AST node, thereby generating the appropriate SQL.

Parameters

UpdateClause $updateClause

Return Value

string The SQL.

string walkUpdateItem(UpdateItem $updateItem)

Walks down an UpdateItem AST node, thereby generating the appropriate SQL.

Parameters

UpdateItem $updateItem

Return Value

string The SQL.

string walkWhereClause(WhereClause $whereClause)

Walks down a WhereClause AST node, thereby generating the appropriate SQL.

WhereClause or not, the appropriate discriminator sql is added.

Parameters

WhereClause $whereClause

Return Value

string The SQL.

string walkConditionalExpression(ConditionalExpression $condExpr)

Walk down a ConditionalExpression AST node, thereby generating the appropriate SQL.

Parameters

ConditionalExpression $condExpr

Return Value

string The SQL.

string walkConditionalTerm(ConditionalTerm $condTerm)

Walks down a ConditionalTerm AST node, thereby generating the appropriate SQL.

Parameters

ConditionalTerm $condTerm

Return Value

string The SQL.

string walkConditionalFactor(ConditionalFactor $factor)

Walks down a ConditionalFactor AST node, thereby generating the appropriate SQL.

Parameters

ConditionalFactor $factor

Return Value

string The SQL.

string walkConditionalPrimary(ConditionalPrimary $primary)

Walks down a ConditionalPrimary AST node, thereby generating the appropriate SQL.

Parameters

ConditionalPrimary $primary

Return Value

string The SQL.

string walkExistsExpression(ExistsExpression $existsExpr)

Walks down an ExistsExpression AST node, thereby generating the appropriate SQL.

Parameters

ExistsExpression $existsExpr

Return Value

string The SQL.

string walkCollectionMemberExpression(CollectionMemberExpression $collMemberExpr)

Walks down a CollectionMemberExpression AST node, thereby generating the appropriate SQL.

Parameters

CollectionMemberExpression $collMemberExpr

Return Value

string The SQL.

string walkEmptyCollectionComparisonExpression(EmptyCollectionComparisonExpression $emptyCollCompExpr)

Walks down an EmptyCollectionComparisonExpression AST node, thereby generating the appropriate SQL.

Parameters

EmptyCollectionComparisonExpression $emptyCollCompExpr

Return Value

string The SQL.

string walkNullComparisonExpression(NullComparisonExpression $nullCompExpr)

Walks down a NullComparisonExpression AST node, thereby generating the appropriate SQL.

Parameters

NullComparisonExpression $nullCompExpr

Return Value

string The SQL.

string walkInExpression(InExpression $inExpr)

Walks down an InExpression AST node, thereby generating the appropriate SQL.

Parameters

InExpression $inExpr

Return Value

string The SQL.

string walkInstanceOfExpression(InstanceOfExpression $instanceOfExpr)

Walks down an InstanceOfExpression AST node, thereby generating the appropriate SQL.

Parameters

InstanceOfExpression $instanceOfExpr

Return Value

string The SQL.

string walkLiteral(mixed $literal)

Walks down a literal that represents an AST node, thereby generating the appropriate SQL.

Parameters

mixed $literal

Return Value

string The SQL.

string walkBetweenExpression(BetweenExpression $betweenExpr)

Walks down a BetweenExpression AST node, thereby generating the appropriate SQL.

Parameters

BetweenExpression $betweenExpr

Return Value

string The SQL.

string walkLikeExpression(LikeExpression $likeExpr)

Walks down a LikeExpression AST node, thereby generating the appropriate SQL.

Parameters

LikeExpression $likeExpr

Return Value

string The SQL.

string walkStateFieldPathExpression(PathExpression $stateFieldPathExpression)

Walks down a StateFieldPathExpression AST node, thereby generating the appropriate SQL.

Parameters

PathExpression $stateFieldPathExpression

Return Value

string The SQL.

string walkComparisonExpression(ComparisonExpression $compExpr)

Walks down a ComparisonExpression AST node, thereby generating the appropriate SQL.

Parameters

ComparisonExpression $compExpr

Return Value

string The SQL.

string walkInputParameter(InputParameter $inputParam)

Walks down an InputParameter AST node, thereby generating the appropriate SQL.

Parameters

InputParameter $inputParam

Return Value

string The SQL.

string walkArithmeticExpression(ArithmeticExpression $arithmeticExpr)

Walks down an ArithmeticExpression AST node, thereby generating the appropriate SQL.

Parameters

ArithmeticExpression $arithmeticExpr

Return Value

string The SQL.

string walkArithmeticTerm(mixed $term)

Walks down an ArithmeticTerm AST node, thereby generating the appropriate SQL.

Parameters

mixed $term

Return Value

string The SQL.

string walkStringPrimary(mixed $stringPrimary)

Walks down a StringPrimary that represents an AST node, thereby generating the appropriate SQL.

Parameters

mixed $stringPrimary

Return Value

string The SQL.

string walkArithmeticFactor(mixed $factor)

Walks down an ArithmeticFactor that represents an AST node, thereby generating the appropriate SQL.

Parameters

mixed $factor

Return Value

string The SQL.

string walkSimpleArithmeticExpression(SimpleArithmeticExpression $simpleArithmeticExpr)

Walks down an SimpleArithmeticExpression AST node, thereby generating the appropriate SQL.

Parameters

SimpleArithmeticExpression $simpleArithmeticExpr

Return Value

string The SQL.

string walkPathExpression(mixed $pathExpr)

Walks down a PathExpression AST node, thereby generating the appropriate SQL.

Parameters

mixed $pathExpr

Return Value

string The SQL.

string walkResultVariable(string $resultVariable)

Walks down a ResultVariable that represents an AST node, thereby generating the appropriate SQL.

Parameters

string $resultVariable

Return Value

string The SQL.

AbstractSqlExecutor getExecutor(DeleteStatement|UpdateStatement|SelectStatement $AST)

Gets an executor that can be used to execute the result of this walker.