-
-
Notifications
You must be signed in to change notification settings - Fork 587
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
Jms deserializer class with parent properties #1135
Comments
In jms/serializer properties are per class. Any change that you need in the parent class have to be done in the parent class metadata definition. If you need to deserialize a json, make sure to provide the |
@goetas Example I have one parent class and two child with differ serialize rules, serialized name example, this mean need deserializer the same model but with the differ properties configurationб becasuse from different resources got different json {
} and {
} for this case I create one parent class and two child and create two yml configuration for child... But in yml driver class, properties not set to metadata class, because getProperties for But if it wrong approach, could you explain how to do it right ? |
I don't need provide type or something else for parent class, because it should be dynamically by creating configuration for each child classes. This approach does not imply configuration properties for parent class, only for childs |
Dynanic type should be done by type handlers or event listeners. Each property must have a type defined. |
@goetas yes, it's true, each property must have type (but if
and
and parent
and json for
and json for
In this case I don't need create to separaet model, just one, abstract class and two empty child with differ configuration |
@goetas and I suggest use pre deserilizer where cast json to one format bad idea, becase there can be many entry points and each can have its own json format. I agree it sounds bad, but it could be |
In |
@goetas property |
I use
"jms/serializer": "^3.3",
stand alone. And my goal create parent class for two child with common properties. I did it. Cretae parent classRequest
and two child -ApiRequest
andFormRequest
. Child differ in that they have different serializer names for properties that's all. I use yml mapping.Child
and child config
CDB.Collection.DTO.ApiRequest.yml
For parent I don't have config
and when I try deserialize json
Object have empty property
When I try deserializer json
I determined that metadata for child class did not contain `propertyMetadata. When I remove condtiion in
src/Metadata/Driver/YamlDriver.php
from
to
$metadata
for my class metadata began to contain data about my child class. Because$class->getProperties()
reflection function which get properties from parent, that's why property class name and class for which metadata generated is different.Maybe I select wrong way or who know how to correct work with yml configuration for class whose properties from parent classes ?
Steps required to reproduce the problem
Expected Result
Actual Result
propertyMetadata
The text was updated successfully, but these errors were encountered: