mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Doctrine does not hydrates a query correctly! #6232
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 @engharb on GitHub (May 2, 2019).
Originally assigned to: @Ocramius on GitHub.
Current ORM version is: 2.6
Support Question
I have two entities with declared relationship as ManyToMany or else. But in my DQL query I want to define a JOIN WITH in order to hydrate the resulted objects of two different entities i.e as the following:
Entity_A Entity_B
a1 b1
a2 b2
a3 b1
my query:
The result is :
array [
0 => a1,
1 => b1,
2 => a2,
3 => b2,
4 => a3,
5 => b1
]
But It should be or I want it to be as:
Array => [
0 => [a1, b1],
1 => [a2, b2],
3 => [a3, b1]
]
Why the query does not return a hydrated result correctly in case that there is no declared relationship between different entities?
@Ocramius commented on GitHub (May 2, 2019):
As confusing as it might seem, that is the correct hydration for arbitrary joins. Sadly, we cannot change that, as it would be a very subtle BC break.
@engharb commented on GitHub (May 2, 2019):
@Ocramius Do you have any workaround?
@Ocramius commented on GitHub (May 2, 2019):
You can try hydrating with
SELECT a AS key1, b AS key2 FROM ...: I don't remember what kind of structure that produces though.