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