Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc4e19b

Browse files
committed
bug #46847 [Serializer] Cannot use Context attribute context in AdvancedNameConverterInterface::denormalize (ogizanagi)
This PR was merged into the 6.2 branch. Discussion ---------- [Serializer] Cannot use Context attribute context in AdvancedNameConverterInterface::denormalize | Q | A | ------------- | --- | Branch? | 6.2 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #46680 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | N/A I realized we can't use the `Context` attribute context in an `AdvancedNameConverterInterface::denormalize`, same as spotted already in 5.4 in #46525. Also adds the missing CHANGELOG entry for #46680 Commits ------- c99082c [Serializer] Cannot use @context context in AdvancedNameConverterInterface::denormalize
2 parents 634bab3 + c99082c commit fc4e19b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Symfony/Component/Serializer/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.2
5+
---
6+
7+
* Add support for constructor promoted properties to `Context` attribute
8+
49
6.1
510
---
611

src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ protected function instantiateObject(array &$data, string $class, array &$contex
334334
$params = [];
335335
foreach ($constructorParameters as $constructorParameter) {
336336
$paramName = $constructorParameter->name;
337-
$attributeContext = $this->getAttributeDenormalizationContext($class, $paramName, $context);
338-
$key = $this->nameConverter ? $this->nameConverter->normalize($paramName, $class, $format, $attributeContext) : $paramName;
337+
$key = $this->nameConverter ? $this->nameConverter->normalize($paramName, $class, $format, $context) : $paramName;
338+
$attributeContext = $this->getAttributeDenormalizationContext($class, $key, $context);
339339

340340
$allowed = false === $allowedAttributes || \in_array($paramName, $allowedAttributes);
341341
$ignored = !$this->isAllowedAttribute($class, $paramName, $format, $context);

0 commit comments

Comments
 (0)