@@ -1344,6 +1344,12 @@ normalizers (in order of priority):
1344
1344
`RFC 3339 `_ format. Use ``DateTimeNormalizer::FORMAT_KEY `` and
1345
1345
``DateTimeNormalizer::TIMEZONE_KEY `` to change the format.
1346
1346
1347
+ To always create :phpclass: `DateTime ` and :phpclass: `DateTimeImmutable `
1348
+ with the timezone specified in the context, set the
1349
+ ``DateTimeNormalizer::PRESERVE_CONTEXT_TIMEZONE_KEY `` context option to
1350
+ ``true ``. This will preserve the timezone of the context and ignores any
1351
+ timezone from the input.
1352
+
1347
1353
To convert the objects to integers or floats, set the serializer
1348
1354
context option ``DateTimeNormalizer::CAST_KEY `` to ``int `` or
1349
1355
``float ``.
@@ -1352,6 +1358,10 @@ normalizers (in order of priority):
1352
1358
1353
1359
The ``DateTimeNormalizer::CAST_KEY `` context option was introduced in Symfony 7.1.
1354
1360
1361
+ .. versionadded :: 7.3
1362
+
1363
+ The ``DateTimeNormalizer::PRESERVE_CONTEXT_TIMEZONE_KEY `` context option was introduced in Symfony 7.3.
1364
+
1355
1365
:class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ ConstraintViolationListNormalizer `
1356
1366
This normalizer converts objects that implement
1357
1367
:class: `Symfony\\ Component\\ Validator\\ ConstraintViolationListInterface `
@@ -1436,7 +1446,7 @@ normalizers (in order of priority):
1436
1446
1437
1447
$propertyInfo = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
1438
1448
$normalizers = [new ObjectNormalizer(new ClassMetadataFactory(new AttributeLoader()), null, null, $propertyInfo), new ArrayDenormalizer()];
1439
-
1449
+
1440
1450
$this->serializer = new Serializer($normalizers, [new JsonEncoder()]);
1441
1451
1442
1452
:class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ ObjectNormalizer `
0 commit comments