[2.0] Minor change in *Walker to be able to be used by custom assigned Walkers
This commit is contained in:
parent
0a497062c9
commit
733556b632
4 changed files with 18 additions and 6 deletions
|
@ -257,7 +257,8 @@ class Parser
|
|||
}
|
||||
|
||||
// Create TreeWalker who creates the SQL from the AST
|
||||
$treeWalker = $this->_treeWalker ?: new SqlWalker(
|
||||
$treeWalker = $this->_treeWalker ?: new SqlWalker();
|
||||
$treeWalker->init(
|
||||
$this->_query, $this->_parserResult, $this->_queryComponents
|
||||
);
|
||||
|
||||
|
|
|
@ -72,12 +72,9 @@ class SqlWalker implements TreeWalker
|
|||
private $_useSqlTableAliases = true;
|
||||
|
||||
/**
|
||||
* Initializes a new SqlWalker instance with the given Query and ParserResult.
|
||||
*
|
||||
* @param Query $query The parsed Query.
|
||||
* @param ParserResult $parserResult The result of the parsing process.
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function __construct($query, $parserResult, array $queryComponents)
|
||||
public function init($query, $parserResult, array $queryComponents)
|
||||
{
|
||||
$this->_rsm = $parserResult->getResultSetMapping();
|
||||
$this->_query = $query;
|
||||
|
|
|
@ -29,6 +29,15 @@ namespace Doctrine\ORM\Query;
|
|||
*/
|
||||
interface TreeWalker
|
||||
{
|
||||
/**
|
||||
* Initializes TreeWalker with important information about the ASTs to be walked
|
||||
*
|
||||
* @param Query $query The parsed Query.
|
||||
* @param ParserResult $parserResult The result of the parsing process.
|
||||
* @param array $queryComponents Query components (symbol table)
|
||||
*/
|
||||
function init($query, $parserResult, array $queryComponents);
|
||||
|
||||
/**
|
||||
* Walks down a SelectStatement AST node, thereby generating the appropriate SQL.
|
||||
*
|
||||
|
|
|
@ -30,6 +30,11 @@ namespace Doctrine\ORM\Query;
|
|||
*/
|
||||
abstract class TreeWalkerAdapter implements TreeWalker
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init($query, $parserResult, array $queryComponents) {}
|
||||
|
||||
/**
|
||||
* Walks down a SelectStatement AST node, thereby generating the appropriate SQL.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue