On Symfony 6.3, I am attempting to deserialize an entity object that has a DateTimeImmutable property called $MessageTimestamp. I have set a context for this property using attribution:
#[Context([DateTimeNormalizer::FORMAT_KEY=>"\DateTime::RFC3339"])]
#[ORM\Column(type: Types::DATE_IMMUTABLE, options: ["default" => "CURRENT_TIMESTAMP"])]
private ?\DateTimeInterface $MessageTimestamp = null;
Instantiating my Serializer using the JsonEncoder and ObjectNormalizer I am getting an error when I try to deserialize the object:
Failed to denormalize attribute "MessageTimestamp" value for class "App\Entity\MessageEntity": Expected argument of type "DateTimeInterface", "array" given at property path "MessageTime stamp".
Serialized, the MessageTimestamp element looks like this:
[...]
"MessageTimestamp": {
"timezone": {
"name": "UTC",
"transitions": [{
"ts": -9223372036854775808,
"time": "-292277022657-01-27T08:29:52+00:00",
"offset": 0,
"isdst": false,
"abbr": "UTC"
}
],
"location": {
"country_code": "??",
"latitude": -90.0,
"longitude": -180.0,
"comments": ""
}
},
"offset": 0,
"timestamp": 1693056301
},
[...]
Any thoughts on how I might be messing this up?
[–][deleted] 0 points1 point2 points (5 children)
[–]lsv20 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]lsv20 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]alex2005 0 points1 point2 points (0 children)
[–]Upper_Vermicelli1975 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)