I have a symfony serializer that i initialize this way :
$this->serializer = new Serializer(
[
new ArrayDenormalizer(),
new UidNormalizer(),
new BackedEnumNormalizer(),
new DateTimeNormalizer(),
new ObjectNormalizer(
classMetadataFactory: new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())),
nameConverter: new CamelCaseToSnakeCaseNameConverter(),
propertyTypeExtractor: new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()])
),
],
[new JsonEncoder()]
);
and a method on my object, i want to serialize with a specific name (getRrule being an existant method so i can't just rename it)
#[Serializer\Groups(['prestation:default'])]
#[Serializer\SerializedName('rrule')]
public function getRruleRfcString(): ?string
{
return $this->rrule?->rfcString();
}
but when serialized i get : "rrule_rfc_string" => null
instead of : "rrule" => null
also the serialization group is working fine so i dont know why only one attribute out of two are working...