abstract class ExpressionVisitor in Plug 7
An Expression visitor walks a graph of expressions and turns them into a query for the underlying implementation.
@author Benjamin Eberlei <kontakt@beberlei.de>
Hierarchy
- class \Doctrine\Common\Collections\Expr\ExpressionVisitor
Expanded class hierarchy of ExpressionVisitor
File
- lib/
doctrine/ collections/ lib/ Doctrine/ Common/ Collections/ Expr/ ExpressionVisitor.php, line 28
Namespace
Doctrine\Common\Collections\ExprView source
abstract class ExpressionVisitor {
/**
* Converts a comparison expression into the target query language output.
*
* @param Comparison $comparison
*
* @return mixed
*/
public abstract function walkComparison(Comparison $comparison);
/**
* Converts a value expression into the target query language part.
*
* @param Value $value
*
* @return mixed
*/
public abstract function walkValue(Value $value);
/**
* Converts a composite expression into the target query language output.
*
* @param CompositeExpression $expr
*
* @return mixed
*/
public abstract function walkCompositeExpression(CompositeExpression $expr);
/**
* Dispatches walking an expression to the appropriate handler.
*
* @param Expression $expr
*
* @return mixed
*
* @throws \RuntimeException
*/
public function dispatch(Expression $expr) {
switch (true) {
case $expr instanceof Comparison:
return $this
->walkComparison($expr);
case $expr instanceof Value:
return $this
->walkValue($expr);
case $expr instanceof CompositeExpression:
return $this
->walkCompositeExpression($expr);
default:
throw new \RuntimeException("Unknown Expression " . get_class($expr));
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExpressionVisitor:: |
public | function | Dispatches walking an expression to the appropriate handler. | |
ExpressionVisitor:: |
abstract public | function | Converts a comparison expression into the target query language output. | 1 |
ExpressionVisitor:: |
abstract public | function | Converts a composite expression into the target query language output. | 1 |
ExpressionVisitor:: |
abstract public | function | Converts a value expression into the target query language part. | 1 |