I'm trying to do the following:
I want to have one set of serialized names when (de)serializing xml and a different set when using json for the same properties of one class?
I managed to do this manually by using different config files and then loading them manually using the serializer builder:
$serializer =
JMS\Serializer\SerializerBuilder::create()
->addMetadataDir($someDir)
->build();
Is it possible to do something similar using the jms_serializer service from sf container?
Is there any other smarter/easier ways to implement this?
Using duplicate properties and groups like the following is not an option:
.....
protected $emailAddressJson;
protected $emailAddressXML;
.....
Json yaml config:
-----------------
emailAddressJson:
serialized_name: emailAddress
groups: [json]
XML yaml config
---------------
emailAddressXML:
serialized_name: EMAIL_ADDRESS
groups: [xml]