You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 class Request and two child - ApiRequest and FormRequest. Child differ in that they have different serializer names for properties that's all. I use yml mapping.
/**
* Class Request
*/
class Request
{
/**
* @var SignatureType
* @Assert\NotBlank()
*/
public $signatureType;
Child
/**
* Class ApiRequest
* @package CDB\Collection\DTO
* @RequestApplication()
* @SignatoryTypeConstraint()
*/
class ApiRequest extends Request
{
}
and child config CDB.Collection.DTO.ApiRequest.yml
I determined that metadata for child class did not contain `propertyMetadata. When I remove condtiion in
jms/serializer/src/Metadata/Driver/YamlDriver.php
from
foreach ($class->getProperties() as $property) {
if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
continue;
}
to
foreach ($class->getProperties() as $property) {
if ((isset($property->info) && $property->info['class'] !== $name) {
continue;
}
$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 ?
The text was updated successfully, but these errors were encountered:
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
jms/serializer/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 ?
The text was updated successfully, but these errors were encountered: