DDC-915 - Bugfix in Identification Variable reordering in combination with SQL Walkers.
This commit is contained in:
parent
1daf658ec6
commit
5e788a0b84
@ -277,6 +277,21 @@ class Parser
|
|||||||
{
|
{
|
||||||
$AST = $this->getAST();
|
$AST = $this->getAST();
|
||||||
|
|
||||||
|
// Fix order of identification variables.
|
||||||
|
// They have to appear in the select clause in the same order as the
|
||||||
|
// declarations (from ... x join ... y join ... z ...) appear in the query
|
||||||
|
// as the hydration process relies on that order for proper operation.
|
||||||
|
if ( count($this->_identVariableExpressions) > 1) {
|
||||||
|
foreach ($this->_queryComponents as $dqlAlias => $qComp) {
|
||||||
|
if (isset($this->_identVariableExpressions[$dqlAlias])) {
|
||||||
|
$expr = $this->_identVariableExpressions[$dqlAlias];
|
||||||
|
$key = array_search($expr, $AST->selectClause->selectExpressions);
|
||||||
|
unset($AST->selectClause->selectExpressions[$key]);
|
||||||
|
$AST->selectClause->selectExpressions[] = $expr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (($customWalkers = $this->_query->getHint(Query::HINT_CUSTOM_TREE_WALKERS)) !== false) {
|
if (($customWalkers = $this->_query->getHint(Query::HINT_CUSTOM_TREE_WALKERS)) !== false) {
|
||||||
$this->_customTreeWalkers = $customWalkers;
|
$this->_customTreeWalkers = $customWalkers;
|
||||||
}
|
}
|
||||||
@ -302,21 +317,6 @@ class Parser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix order of identification variables.
|
|
||||||
// They have to appear in the select clause in the same order as the
|
|
||||||
// declarations (from ... x join ... y join ... z ...) appear in the query
|
|
||||||
// as the hydration process relies on that order for proper operation.
|
|
||||||
if ( count($this->_identVariableExpressions) > 1) {
|
|
||||||
foreach ($this->_queryComponents as $dqlAlias => $qComp) {
|
|
||||||
if (isset($this->_identVariableExpressions[$dqlAlias])) {
|
|
||||||
$expr = $this->_identVariableExpressions[$dqlAlias];
|
|
||||||
$key = array_search($expr, $AST->selectClause->selectExpressions);
|
|
||||||
unset($AST->selectClause->selectExpressions[$key]);
|
|
||||||
$AST->selectClause->selectExpressions[] = $expr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->_customOutputWalker) {
|
if ($this->_customOutputWalker) {
|
||||||
$outputWalker = new $this->_customOutputWalker(
|
$outputWalker = new $this->_customOutputWalker(
|
||||||
$this->_query, $this->_parserResult, $this->_queryComponents
|
$this->_query, $this->_parserResult, $this->_queryComponents
|
||||||
|
Loading…
Reference in New Issue
Block a user