mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
ObjectHydrator and ArrayHydrator incorrectly hydrate fields of child classes in a JTI when a field name collides
#5430
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 @fullbl on GitHub (Feb 24, 2017).
Originally assigned to: @Ocramius on GitHub.
Hi,
I have an entity named A, which is extended on multi table inheritance by B and C.
Both have a property called $user, which is a simple string on B and a simple_array on C.
If I load the object by query builder with the repository of A and get an object of type B, I could get an empty array, even if I'm expecting a string. This is because AbstractHydrator is setting first non null value from all the joined tabled after translating it into php. Null is converted into array in SimpleArrayType convertToPHPValue function.
An easy solution could be to check for the value to be null BEFORE assigning it, as for #5989
@dengm129 commented on GitHub (Jun 21, 2017):
#5989
@Ocramius commented on GitHub (Aug 19, 2017):
Handled in #6304