Skip to content

Add a setter on DateTimeNormalizer to change the default context at runtime #44125

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Changes from all 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
Add a setter on DateTimeNormalizer to change the default context at r…
…untime
  • Loading branch information
Seldaek authored Nov 18, 2021
commit 6852ca763ea005bb6e45bf75a8cc0c0937a933cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class DateTimeNormalizer implements NormalizerInterface, DenormalizerInterface,
];

public function __construct(array $defaultContext = [])
{
$this->setDefaultContext($defaultContext);
}

public function setDefaultContext(array $defaultContext): void
{
$this->defaultContext = array_merge($this->defaultContext, $defaultContext);
}
Expand Down