Open kshtompel opened 1 month ago
Currently can be tackled with inheritance from the base SqlWalker and overriding
public function walkGroupByItem($groupByItem): string
method
but all the checks from parent should be covered for instance: if $groupByItem is not path_expression, not returning variable, etc..
Bug Report
While using groupBy(DQL_ALIAS) for aggregated query resulted SQL with missing discriminator field and this is leading to
[42803] ERROR: column "p0_.type" must appear in the GROUP BY clause or be used in an aggregate function
Summary
Suggestion to fix
Current behavior
No discriminator field added to GROUP BY clause
How to reproduce
Create aggregated query with group by entity identification alias and entity has discriminator field.
As a result there is no discriminator field in the resulted SQL GROUP BY clause
Expected behavior
All the columns should appear in the SQL GROUP BY clause for aggregated queries