New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hydratation error when two classes with the same parent class both define the same property with different types. #7505
Comments
I'm creating a pull request with a failing test case. |
This should be a validation error: these columns MUST have different names. |
@Ocramius Thanks for answering so quickly and noticing that: I made an error when writing the issue and the names of the columns are missing in the annotation. The behavior is the same when the columns have different names, I updated the code in the issue to fix the column names. |
@m-r-r there are two issues then:
|
@Ocramius Ok ! Should I open a second issue for the validation problem ? |
@m-r-r yes please, or maybe just create a failing test case involving the schema validator 👍 |
@Ocramius the hydrator code has multiple paths where it has comments mentioning the handling of duplicate field names across the hierachy, so it is actually supported to do this right now. |
[GH-7505] Bug in SimpleObjectHydrator when using inheritance with same field
Fixed |
Bug Report
Summary
SimpleObjectHydrator
produces a type error when two classes with the same parent class both define a property with the same name and different types.I think this may be related to issue #5989.
Current behavior
When two classes inherit from the same parent using
SINGLE_TABLE
inheritance, and both classes define the same property with different types,SimpleObjectHydrator
produce a type error if one of the properties is of typesimple_array
.How to reproduce
Create an abstract class with two child classes:
Create two child classes. Each class defines the same property with different types.
The first class use the type
simple_array
and the second class has astring
property :Create an instance of the second class and flush the
EntityManager
:Clear the
EntityManager
and fetch the instance:Expected behavior
The value of
$textResponse->value
should be NULL, because the property$value
of classTextResponse
has typestring|null
.The text was updated successfully, but these errors were encountered: