Skip to content

Commit

Permalink
fixup! only add relation identifier when at least one relation column…
Browse files Browse the repository at this point in the history
… is selected
  • Loading branch information
alquerci committed Apr 17, 2024
1 parent 7b6763b commit 01fd136
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Doctrine/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ public function parseSelect($dql)

$terms = $this->_tokenizer->sqlExplode($reference, ' ');
$pos = strpos($terms[0], '(');
$isColumnSelect = $pos === false;

if (count($terms) > 1 || $pos !== false) {
$expression = array_shift($terms);
Expand Down Expand Up @@ -648,7 +649,7 @@ public function parseSelect($dql)

$this->_queryComponents[$componentAlias]['agg'][$index] = $alias;
$this->_queryComponents[$componentAlias]['has_selected_column'] ??= false;
$this->_queryComponents[$componentAlias]['has_selected_column'] |= $pos === false;
$this->_queryComponents[$componentAlias]['has_selected_column'] |= $isColumnSelect;

if (preg_match('/^([^\(]+)\.(\'?)(.*?)(\'?)$/', $expression, $field)) {
$this->_queryComponents[$componentAlias]['agg_field'][$index] = $field[3];
Expand Down

0 comments on commit 01fd136

Please sign in to comment.