[Config] Prototypes info
This commit is contained in:
parent
6fd4019975
commit
599fcb4868
@ -84,14 +84,18 @@ class XmlReferenceDumper
|
||||
|
||||
// render prototyped nodes
|
||||
if ($node instanceof PrototypedArrayNode) {
|
||||
array_unshift($rootComments, 'prototype');
|
||||
$prototype = $node->getPrototype();
|
||||
|
||||
$info = 'prototype';
|
||||
if (null !== $prototype->getInfo()) {
|
||||
$info .= ': '.$prototype->getInfo();
|
||||
}
|
||||
array_unshift($rootComments, $info);
|
||||
|
||||
if ($key = $node->getKeyAttribute()) {
|
||||
$rootAttributes[$key] = str_replace('-', ' ', $rootName).' '.$key;
|
||||
}
|
||||
|
||||
$prototype = $node->getPrototype();
|
||||
|
||||
if ($prototype instanceof ArrayNode) {
|
||||
$children = $prototype->getChildren();
|
||||
} else {
|
||||
|
@ -69,7 +69,12 @@ class YamlReferenceDumper
|
||||
if ($key = $node->getKeyAttribute()) {
|
||||
$keyNodeClass = 'Symfony\Component\Config\Definition\\'.($prototype instanceof ArrayNode ? 'ArrayNode' : 'ScalarNode');
|
||||
$keyNode = new $keyNodeClass($key, $node);
|
||||
$keyNode->setInfo('Prototype');
|
||||
|
||||
$info = 'Prototype';
|
||||
if (null !== $prototype->getInfo()) {
|
||||
$info .= ': '.$prototype->getInfo();
|
||||
}
|
||||
$keyNode->setInfo($info);
|
||||
|
||||
// add children
|
||||
foreach ($children as $childNode) {
|
||||
|
@ -64,7 +64,7 @@ class XmlReferenceDumperTest extends \PHPUnit_Framework_TestCase
|
||||
child3=""
|
||||
/>
|
||||
|
||||
<!-- prototype -->
|
||||
<!-- prototype: Parameter name -->
|
||||
<parameter name="parameter name">scalar value</parameter>
|
||||
|
||||
<!-- prototype -->
|
||||
|
@ -56,7 +56,7 @@ acme_root:
|
||||
child3: ~ # Example: example setting
|
||||
parameters:
|
||||
|
||||
# Prototype
|
||||
# Prototype: Parameter name
|
||||
name: ~
|
||||
connections:
|
||||
# Prototype
|
||||
|
@ -53,7 +53,7 @@ class ExampleConfiguration implements ConfigurationInterface
|
||||
->end()
|
||||
->arrayNode('parameters')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('scalar')->end()
|
||||
->prototype('scalar')->info('Parameter name')->end()
|
||||
->end()
|
||||
->arrayNode('connections')
|
||||
->prototype('array')
|
||||
|
Reference in New Issue
Block a user