[FrameworkBundle] Calls support for debug:container

This commit is contained in:
JhonnyL 2016-04-02 14:24:20 +02:00
parent cef7e5b1b0
commit b2d10382f7
18 changed files with 69 additions and 1 deletions

View File

@ -242,6 +242,14 @@ class JsonDescriptor extends Descriptor
}
}
$calls = $definition->getMethodCalls();
if (count($calls) > 0) {
$data['calls'] = array();
foreach ($calls as $callData) {
$data['calls'][] = $callData[0];
}
}
if (!$omitTags) {
$data['tags'] = array();
if (count($definition->getTags())) {

View File

@ -214,6 +214,11 @@ class MarkdownDescriptor extends Descriptor
}
}
$calls = $definition->getMethodCalls();
foreach ($calls as $callData) {
$output .= "\n".'- Call: `'.$callData[0].'`';
}
if (!(isset($options['omit_tags']) && $options['omit_tags'])) {
foreach ($definition->getTags() as $tagName => $tagData) {
foreach ($tagData as $parameters) {

View File

@ -275,6 +275,15 @@ class TextDescriptor extends Descriptor
}
$tableRows[] = array('Tags', $tagInformation);
$calls = $definition->getMethodCalls();
if (count($calls) > 0) {
$callInformation = [];
foreach ($calls as $call) {
$callInformation[] = $call[0];
}
$tableRows[] = array('Calls', implode(', ', $callInformation));
}
$tableRows[] = array('Public', $definition->isPublic() ? 'yes' : 'no');
$tableRows[] = array('Synthetic', $definition->isSynthetic() ? 'yes' : 'no');
$tableRows[] = array('Lazy', $definition->isLazy() ? 'yes' : 'no');

View File

@ -360,6 +360,15 @@ class XmlDescriptor extends Descriptor
$serviceXML->setAttribute('file', $definition->getFile());
$calls = $definition->getMethodCalls();
if (count($calls) > 0) {
$serviceXML->appendChild($callsXML = $dom->createElement('calls'));
foreach ($calls as $callData) {
$callsXML->appendChild($callXML = $dom->createElement('call'));
$callXML->setAttribute('method', $callData[0]);
}
}
if (!$omitTags) {
$tags = $definition->getTags();

View File

@ -115,6 +115,7 @@ class ObjectsProvider
->addTag('tag1', array('attr1' => 'val1', 'attr2' => 'val2'))
->addTag('tag1', array('attr3' => 'val3'))
->addTag('tag2')
->addMethodCall('setMailer', array(new Reference('mailer')))
->setFactory(array(new Reference('factory.service'), 'get')),
);
}

View File

@ -47,6 +47,9 @@
]
}
],
"calls": [
"setMailer"
],
"autowire": false,
"autowiring_types": []
}

View File

@ -30,6 +30,7 @@ definition_2
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`
- Call: `setMailer`
- Tag: `tag1`
- Attr1: val1
- Attr2: val2

View File

@ -7,6 +7,9 @@
</definition>
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
<calls>
<call method="setMailer"/>
</calls>
<tags>
<tag name="tag1">
<parameter name="attr1">val1</parameter>

View File

@ -31,6 +31,9 @@
]
}
],
"calls": [
"setMailer"
],
"autowire": false,
"autowiring_types": []
}

View File

@ -17,6 +17,7 @@ definition_2
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`
- Call: `setMailer`
- Tag: `tag1`
- Attr1: val1
- Attr2: val2

View File

@ -2,6 +2,9 @@
<container>
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
<calls>
<call method="setMailer"/>
</calls>
<tags>
<tag name="tag1">
<parameter name="attr1">val1</parameter>

View File

@ -8,6 +8,9 @@
"shared": true,
"abstract": false,
"file": "\/path\/to\/file",
"calls": [
"setMailer"
],
"factory_service": "factory.service",
"factory_method": "get",
"autowire": false,
@ -23,6 +26,9 @@
"shared": true,
"abstract": false,
"file": "\/path\/to\/file",
"calls": [
"setMailer"
],
"factory_service": "factory.service",
"factory_method": "get",
"autowire": false,

View File

@ -17,6 +17,7 @@ definition_2
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`
- Call: `setMailer`
tag2
@ -35,3 +36,4 @@ definition_2
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`
- Call: `setMailer`

View File

@ -3,11 +3,17 @@
<tag name="tag1">
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
<calls>
<call method="setMailer"/>
</calls>
</definition>
</tag>
<tag name="tag2">
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
<calls>
<call method="setMailer"/>
</calls>
</definition>
</tag>
</container>

View File

@ -29,6 +29,9 @@
]
}
],
"calls": [
"setMailer"
],
"autowire": false,
"autowiring_types": []
}

View File

@ -8,9 +8,10 @@
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`
- Call: `setMailer`
- Tag: `tag1`
- Attr1: val1
- Attr2: val2
- Tag: `tag1`
- Attr3: val3
- Tag: `tag2`
- Tag: `tag2`

View File

@ -4,6 +4,7 @@
Service ID -
Class Full\Qualified\Class2
Tags tag1 (attr1: val1, attr2: val2)tag1 (attr3: val3)tag2
Calls setMailer
Public no
Synthetic yes
Lazy no

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<definition class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
<calls>
<call method="setMailer"/>
</calls>
<tags>
<tag name="tag1">
<parameter name="attr1">val1</parameter>