diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index 243878804..d16aced52 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -21,10 +21,10 @@ namespace Doctrine\ORM\Query; -use Doctrine\Common\DoctrineException; -use Doctrine\ORM\Query; -use Doctrine\ORM\Query\AST; -use Doctrine\ORM\Query\Exec; +use Doctrine\Common\DoctrineException, + Doctrine\ORM\Query, + Doctrine\ORM\Query\AST, + Doctrine\ORM\Query\Exec; /** * An LL(*) parser for the context-free grammar of the Doctrine Query Language. @@ -257,8 +257,7 @@ class Parser } // Create TreeWalker who creates the SQL from the AST - $treeWalker = $this->_treeWalker ?: new SqlWalker(); - $treeWalker->init( + $treeWalker = $this->_treeWalker ?: new SqlWalker( $this->_query, $this->_parserResult, $this->_queryComponents ); diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index aab173425..4d998e0d6 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -74,7 +74,7 @@ class SqlWalker implements TreeWalker /** * @inheritdoc */ - public function init($query, $parserResult, array $queryComponents) + public function __construct($query, $parserResult, array $queryComponents) { $this->_rsm = $parserResult->getResultSetMapping(); $this->_query = $query; diff --git a/lib/Doctrine/ORM/Query/TreeWalker.php b/lib/Doctrine/ORM/Query/TreeWalker.php index 386b5f683..8773ffdb6 100644 --- a/lib/Doctrine/ORM/Query/TreeWalker.php +++ b/lib/Doctrine/ORM/Query/TreeWalker.php @@ -36,7 +36,7 @@ interface TreeWalker * @param ParserResult $parserResult The result of the parsing process. * @param array $queryComponents Query components (symbol table) */ - function init($query, $parserResult, array $queryComponents); + function __construct($query, $parserResult, array $queryComponents); /** * Walks down a SelectStatement AST node, thereby generating the appropriate SQL. diff --git a/lib/Doctrine/ORM/Query/TreeWalkerAdapter.php b/lib/Doctrine/ORM/Query/TreeWalkerAdapter.php index c61c7f617..940225645 100644 --- a/lib/Doctrine/ORM/Query/TreeWalkerAdapter.php +++ b/lib/Doctrine/ORM/Query/TreeWalkerAdapter.php @@ -33,7 +33,7 @@ abstract class TreeWalkerAdapter implements TreeWalker /** * @inheritdoc */ - public function init($query, $parserResult, array $queryComponents) {} + public function __construct($query, $parserResult, array $queryComponents) {} /** * Walks down a SelectStatement AST node, thereby generating the appropriate SQL. diff --git a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php index 11a1c9924..d6c45305e 100644 --- a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php @@ -48,7 +48,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase $parser = new \Doctrine\ORM\Query\Parser($query); // We do NOT test SQL construction here. That only unnecessarily slows down the tests! - $parser->setTreeWalker(new \Doctrine\Tests\Mocks\MockTreeWalker); + $parser->setTreeWalker(new \Doctrine\Tests\Mocks\MockTreeWalker(null, null, array())); return $parser->parse(); }