Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Serializer] Add PRESERVE_CONTEXT_TIMEZONE_KEY to DateTimeNormalizer#20860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
frankdekker wants to merge1 commit intosymfony:7.3
base:7.3
Choose a base branch
Loading
fromfrankdekker:PR_59807
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletionserializer.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1344,6 +1344,12 @@ normalizers (in order of priority):
`RFC 3339`_ format. Use ``DateTimeNormalizer::FORMAT_KEY`` and
``DateTimeNormalizer::TIMEZONE_KEY`` to change the format.

To always create :phpclass:`DateTime` and :phpclass:`DateTimeImmutable`
with the timezone specified in the context, set the
``DateTimeNormalizer::PRESERVE_CONTEXT_TIMEZONE_KEY`` context option to
``true``. This will preserve the timezone of the context and ignores any
timezone from the input.

To convert the objects to integers or floats, set the serializer
context option ``DateTimeNormalizer::CAST_KEY`` to ``int`` or
``float``.
Expand All@@ -1352,6 +1358,10 @@ normalizers (in order of priority):

The ``DateTimeNormalizer::CAST_KEY`` context option was introduced in Symfony 7.1.

.. versionadded:: 7.3

The ``DateTimeNormalizer::PRESERVE_CONTEXT_TIMEZONE_KEY`` context option was introduced in Symfony 7.3.

:class:`Symfony\\Component\\Serializer\\Normalizer\\ConstraintViolationListNormalizer`
This normalizer converts objects that implement
:class:`Symfony\\Component\\Validator\\ConstraintViolationListInterface`
Expand DownExpand Up@@ -1436,7 +1446,7 @@ normalizers (in order of priority):

$propertyInfo = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
$normalizers = [new ObjectNormalizer(new ClassMetadataFactory(new AttributeLoader()), null, null, $propertyInfo), new ArrayDenormalizer()];

$this->serializer = new Serializer($normalizers, [new JsonEncoder()]);

:class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer`
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp