Closed
Description
Symfony version(s) affected
6.2.0
Description
If SerializedPath is set on non-scalar types, eg. DateTimeImmutable
:
final class ObjectDummyWithContextAttributeAndSerializedPath
{
public function __construct(
#[Context([DateTimeNormalizer::FORMAT_KEY => 'm-d-Y'])]
#[SerializedPath('[property][with_path]')]
public \DateTimeImmutable $propertyWithPath,
) {
}
}
Normalization fails with error:
Symfony\Component\Serializer\Exception\LogicException: The element you are trying to set is already populated: "[property][with_path]"
But DateTimeImmutable
is serialized into string, so expected result is:
['property' => ['with_path' => '02-22-2023']
How to reproduce
I created unit test for this case, which should be sufficient for reproducing: HonzaMatosik@51f1969
Possible Solution
No response
Additional Context
No response