Skip to content

Commit e7d73e8

Browse files
committed
feature #52730 [Serializer] Consider SerializedPath in debug command output (jschaedl)
This PR was squashed before being merged into the 7.1 branch. Discussion ---------- [Serializer] Consider SerializedPath in debug command output | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | - | License | MIT The `debug:serializer` command does not show `SerializedPath` information and I figured it might makes sense to add it. Corresponding symfony-docs pr symfony/symfony-docs#19184 Commits ------- 24cdc43 [Serializer] Consider SerializedPath in debug command output
2 parents cec867e + 24cdc43 commit e7d73e8

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

src/Symfony/Component/Serializer/Command/DebugCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ private function getAttributesData(ClassMetadataInterface $classMetadata): array
102102
'groups' => $attributeMetadata->getGroups(),
103103
'maxDepth' => $attributeMetadata->getMaxDepth(),
104104
'serializedName' => $attributeMetadata->getSerializedName(),
105+
'serializedPath' => $attributeMetadata->getSerializedPath() ? (string) $attributeMetadata->getSerializedPath() : null,
105106
'ignore' => $attributeMetadata->isIgnored(),
106107
'normalizationContexts' => $attributeMetadata->getNormalizationContexts(),
107108
'denormalizationContexts' => $attributeMetadata->getDenormalizationContexts(),

src/Symfony/Component/Serializer/Tests/Command/DebugCommandTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function testOutputWithClassArgument()
4646
| | ], |
4747
| | "maxDepth" => 1, |
4848
| | "serializedName" => "identifier", |
49+
| | "serializedPath" => null, |
4950
| | "ignore" => true, |
5051
| | "normalizationContexts" => [ |
5152
| | "*" => [ |
@@ -66,6 +67,7 @@ public function testOutputWithClassArgument()
6667
| | "groups" => [], |
6768
| | "maxDepth" => null, |
6869
| | "serializedName" => null, |
70+
| | "serializedPath" => [data][name], |
6971
| | "ignore" => false, |
7072
| | "normalizationContexts" => [], |
7173
| | "denormalizationContexts" => [] |

src/Symfony/Component/Serializer/Tests/Dummy/DummyClassOne.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Serializer\Attribute\Ignore;
1717
use Symfony\Component\Serializer\Attribute\MaxDepth;
1818
use Symfony\Component\Serializer\Attribute\SerializedName;
19+
use Symfony\Component\Serializer\Attribute\SerializedPath;
1920

2021
class DummyClassOne
2122
{
@@ -29,5 +30,6 @@ class DummyClassOne
2930
)]
3031
public string $code;
3132

33+
#[SerializedPath('[data][name]')]
3234
public string $name;
3335
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy