1
0
mirror of synced 2025-01-18 14:31:40 +03:00

Add hidden field ordering for postgresql

In postgresql environment, when some hidden fields are used in orderBy clause,
they're not property added because $rsm->scalarMappings don't have information about them.
This commit is contained in:
denkiryokuhatsuden 2013-04-02 18:54:55 +09:00
parent 9b0f252aff
commit 3e8796f781

View File

@ -91,7 +91,25 @@ class LimitSubqueryOutputWalker extends SqlWalker
*/
public function walkSelectStatement(SelectStatement $AST)
{
$innerSql = parent::walkSelectStatement($AST);
if ($this->platform instanceof PostgreSqlPlatform) {
// Set every select expression as visible(hidden = false) to
// make $AST to have scalar mappings properly
$hiddens = array();
foreach ($AST->selectClause->selectExpressions as $idx => $expr) {
$hiddens[$idx] = $expr->hiddenAliasResultVariable;
$expr->hiddenAliasResultVariable = false;
}
$innerSql = parent::walkSelectStatement($AST);
// Restore hiddens
foreach ($AST->selectClause->selectExpressions as $idx => $expr) {
$expr->hiddenAliasResultVariable = $hiddens[$idx];
}
} else {
$innerSql = parent::walkSelectStatement($AST);
}
// Find out the SQL alias of the identifier column of the root entity.
// It may be possible to make this work with multiple root entities but that