From 01fd136d73195aa97ca206e4c83b28385f1a7b5c Mon Sep 17 00:00:00 2001 From: Alexandre Quercia Date: Wed, 17 Apr 2024 23:06:51 +0200 Subject: [PATCH] fixup! only add relation identifier when at least one relation column is selected --- lib/Doctrine/Query.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index f4095b1d..62f238e3 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -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); @@ -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];