Skip to content

Commit

Permalink
Revert "Added fields with alias to pendingFields array, fixed DC-585"
Browse files Browse the repository at this point in the history
This reverts commit e3ae69c.
  • Loading branch information
alquerci authored and thePanz committed Jan 22, 2024
1 parent 2373ce3 commit 29961c7
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions lib/Doctrine/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public function processPendingFields($componentAlias)
}

$sql = array();
foreach ($fields as $fieldAlias => $fieldName) {
foreach ($fields as $fieldName) {
$columnName = $table->getColumnName($fieldName);
if (($owner = $table->getColumnOwner($columnName)) !== null &&
$owner !== $table->getComponentName()) {
Expand All @@ -492,17 +492,10 @@ public function processPendingFields($componentAlias)
. ' AS '
. $this->_conn->quoteIdentifier($tableAlias . '__' . $columnName);
} else {
// Fix for http://www.doctrine-project.org/jira/browse/DC-585
// Take the field alias if available
if (isset($this->_aggregateAliasMap[$fieldAlias])) {
$aliasSql = $this->_aggregateAliasMap[$fieldAlias];
} else {
$columnName = $table->getColumnName($fieldName);
$aliasSql = $this->_conn->quoteIdentifier($tableAlias . '__' . $columnName);
}
$columnName = $table->getColumnName($fieldName);
$sql[] = $this->_conn->quoteIdentifier($tableAlias) . '.' . $this->_conn->quoteIdentifier($columnName)
. ' AS '
. $aliasSql;
. $this->_conn->quoteIdentifier($tableAlias . '__' . $columnName);
}
}

Expand Down Expand Up @@ -656,13 +649,6 @@ public function parseSelect($dql)
$this->_queryComponents[$componentAlias]['agg'][$index] = $alias;

$this->_neededTables[] = $tableAlias;

// Fix for http://www.doctrine-project.org/jira/browse/DC-585
// Add selected columns to pending fields
if (preg_match('/^([^\(]+)\.(\'?)(.*?)(\'?)$/', $expression, $field)) {
$this->_pendingFields[$componentAlias][$alias] = $field[3];
}

} else {
$e = explode('.', $terms[0]);

Expand Down

0 comments on commit 29961c7

Please sign in to comment.