mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
SELECT entity with multiple GROUP BY returns partial result #5696
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @BenMorel on GitHub (Sep 12, 2017).
I have 3 entities:
I'm trying to select the total commission amounts, for each network, grouped by currency.
This translates into
GROUP BY network, merchant.currencyCode.If I select
Network.idonly, it works fine:Now if I select the
Networkentity:It still works fine when using
HYDRATE_ARRAY:But when using
HYDRATE_OBJECT, it only returns the last result for each Network:I created a reproducible example in this repository:
https://github.com/BenMorel/doctrine-groupBy-bug
I could not find any documentation for this behaviour, which I believe is a bug, as it behaves differently based on the hydration mode, in addition to being counter-intuitive.