Commit bf4ea59
committed
bug #51399 [Serializer] Fix deserializing of nested snake_case attributes using CamelCaseToSnakeCaseNameConverter (Victor-Truhanovich)
This PR was squashed before being merged into the 6.3 branch.
Discussion
----------
[Serializer] Fix deserializing of nested snake_case attributes using CamelCaseToSnakeCaseNameConverter
| Q | A
| ------------- | ---
| Branch? | 6.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| License | MIT
It was not possible to deserialize nested attributes using CamelCaseToSnakeCaseNameConverter
### Example
```php
readonly class Foo {
public function __conctruct(
#[SerializedPath("[one][two_three]")]
public $fooBar,
) {
}
}
$factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
$normalizer = new ObjectNormalizer($factory, new CamelCaseToSnakeCaseNameConverter());
$serializer = new Serializer([$normalizer]);
$data = [
'one' => [
'two_three' => 'fooBar',
],
];
$foo = $serializer->denormalize($data, Foo::class, 'any');
```
Commits
-------
f114c55 [Serializer] Fix deserializing of nested snake_case attributes using CamelCaseToSnakeCaseNameConverter2 files changed
Lines changed: 37 additions & 3 deletions
File tree
- src/Symfony/Component/Serializer
- Normalizer
- Tests/Normalizer
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
336 | 338 | | |
337 | 339 | | |
338 | 340 | | |
| |||
345 | 347 | | |
346 | 348 | | |
347 | 349 | | |
348 | | - | |
| 350 | + | |
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
143 | 167 | | |
144 | 168 | | |
145 | 169 | | |
| |||
861 | 885 | | |
862 | 886 | | |
863 | 887 | | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
864 | 896 | | |
865 | 897 | | |
866 | 898 | | |
| |||
0 commit comments