Hello dear Stackoverflow community,
I have 2 PHP class (considered as DTO) that I’m using to set the body of my HTTP calls.
Each DTO is used for a different API with different naming strategies (one is using camelCase and the other one is using snake_case.
I can’t find a solution to inject my JMS serlializer with a different naming strategy for each of these classes.
Here is my current configuration for JMS :
jms_serializer: default_context: serialization: serialize_null: false deserialization: serialize_null: false property_naming: id: 'jms_serializer.identical_property_naming_strategy'
Here is my services definition :
ApiBundleServicesApiOneService: arguments: - '%external_components%' - '@jms_serializer' - '@monolog.logger' ApiBundleServiceApiTwoService: arguments: - '%external_components%' - '@jms_serializer'
Note : I can’t use the @SerializedName annotation because it’s not working if you specify a naming strategy as stated in the JMS documentation
Is there a way to “copy” my JMS service in my services.yml and just change the naming strategy for my ApiTwoService ?
Or any other solution ?
Source: Symfony Questions
Was this helpful?
0 / 0