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

Appearance settings

Commit 46a8ede

Browse filesBrowse files
committed
bug #20341 Fix YamlReferenceDumper unnamed nested prototypes (ogizanagi)
This PR was squashed before being merged into the 3.2-dev branch (closes #20341). Discussion ---------- Fix YamlReferenceDumper unnamed nested prototypes | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20340 | License | MIT | Doc PR | N/A Ideally, I'd like to output something like: ```yml pipou: # Prototype name: # Prototype - didou: ~ ``` But for now, this should fix the regression. Commits ------- 8e04643 Fix YamlReferenceDumper unnamed nested prototypes
2 parents 700c04b + 8e04643 commit 46a8ede
Copy full SHA for 46a8ede

File tree

4 files changed

+24
-1
lines changed
Filter options

4 files changed

+24
-1
lines changed

‎src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private function getPrototypeChildren(PrototypedArrayNode $node)
201201
$keyNode = new ArrayNode($key, $node);
202202
$children = $prototype->getChildren();
203203

204-
if ($prototype instanceof PrototypedArrayNode) {
204+
if ($prototype instanceof PrototypedArrayNode && $prototype->getKeyAttribute()) {
205205
$children = $this->getPrototypeChildren($prototype);
206206
}
207207

‎src/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ enum=""
9292
9393
</cms-page>
9494
95+
<!-- prototype -->
96+
<pipou name="pipou name">
97+
98+
<!-- prototype -->
99+
<name didou="" />
100+
101+
</pipou>
102+
95103
</config>
96104
97105
EOL

‎src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ enum: ~ # One of "this"; "that"
7474
locale:
7575
title: ~ # Required
7676
path: ~ # Required
77+
pipou:
78+
79+
# Prototype
80+
name: []
7781

7882
EOL;
7983
}

‎src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ public function getConfigTreeBuilder()
8080
->end()
8181
->end()
8282
->end()
83+
->arrayNode('pipou')
84+
->useAttributeAsKey('name')
85+
->prototype('array')
86+
->prototype('array')
87+
->children()
88+
->scalarNode('didou')
89+
->end()
90+
->end()
91+
->end()
92+
->end()
93+
->end()
8394
->end()
8495
;
8596

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.