diff --git a/lib/Doctrine/DBAL/Query/QueryBuilder.php b/lib/Doctrine/DBAL/Query/QueryBuilder.php index 12287daf944..46d7db7a21e 100644 --- a/lib/Doctrine/DBAL/Query/QueryBuilder.php +++ b/lib/Doctrine/DBAL/Query/QueryBuilder.php @@ -480,11 +480,12 @@ public function select($select = null) * ->from('users', 'u') * * - * @return self + * @return $this This QueryBuilder instance. */ public function distinct() : self { $this->sqlParts['distinct'] = true; + return $this; } @@ -1117,7 +1118,7 @@ public function resetQueryPart($queryPartName) */ private function getSQLForSelect() { - $query = 'SELECT ' . ($this->sqlParts['distinct'] ? 'DISTINCT ' : '') . + $query = 'SELECT ' . ($this->sqlParts['distinct'] ? 'DISTINCT ' : '') . implode(', ', $this->sqlParts['select']); $query .= ($this->sqlParts['from'] ? ' FROM ' . implode(', ', $this->getFromClauses()) : '')