Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f609224

Browse files
author
JhonnyL
committed
[FrameworkBundle] Calls support for debug:container
1 parent dc189f0 commit f609224

18 files changed

+71
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,14 @@ private function getContainerDefinitionData(Definition $definition, $omitTags =
242242
}
243243
}
244244

245+
$calls = $definition->getMethodCalls();
246+
if (count($calls) > 0) {
247+
$data['calls'] = array();
248+
foreach ($calls as $callData) {
249+
$data['calls'][] = $callData[0];
250+
}
251+
}
252+
245253
if (!$omitTags) {
246254
$data['tags'] = array();
247255
if (count($definition->getTags())) {

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ protected function describeContainerDefinition(Definition $definition, array $op
214214
}
215215
}
216216

217+
$calls = $definition->getMethodCalls();
218+
if (count($calls) > 0) {
219+
foreach ($calls as $callData) {
220+
$output .= "\n".'- Call: `'.$callData[0].'`';
221+
}
222+
}
223+
217224
if (!(isset($options['omit_tags']) && $options['omit_tags'])) {
218225
foreach ($definition->getTags() as $tagName => $tagData) {
219226
foreach ($tagData as $parameters) {

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@ protected function describeContainerDefinition(Definition $definition, array $op
275275
}
276276
$tableRows[] = array('Tags', $tagInformation);
277277

278+
$calls = $definition->getMethodCalls();
279+
if (count($calls) > 0) {
280+
$callInformation = [];
281+
foreach ($calls as $call) {
282+
$callInformation[] = $call[0];
283+
}
284+
$tableRows[] = array('Calls', implode(', ', $callInformation));
285+
}
286+
278287
$tableRows[] = array('Public', $definition->isPublic() ? 'yes' : 'no');
279288
$tableRows[] = array('Synthetic', $definition->isSynthetic() ? 'yes' : 'no');
280289
$tableRows[] = array('Lazy', $definition->isLazy() ? 'yes' : 'no');

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,15 @@ private function getContainerDefinitionDocument(Definition $definition, $id = nu
360360

361361
$serviceXML->setAttribute('file', $definition->getFile());
362362

363+
$calls = $definition->getMethodCalls();
364+
if (count($calls) > 0) {
365+
$serviceXML->appendChild($callsXML = $dom->createElement('calls'));
366+
foreach ($calls as $callData) {
367+
$callsXML->appendChild($callXML = $dom->createElement('call'));
368+
$callXML->setAttribute('method', $callData[0]);
369+
}
370+
}
371+
363372
if (!$omitTags) {
364373
$tags = $definition->getTags();
365374

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public static function getContainerDefinitions()
115115
->addTag('tag1', array('attr1' => 'val1', 'attr2' => 'val2'))
116116
->addTag('tag1', array('attr3' => 'val3'))
117117
->addTag('tag2')
118+
->addMethodCall('setMailer', array(new Reference('mailer')))
118119
->setFactory(array(new Reference('factory.service'), 'get')),
119120
);
120121
}

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
]
4848
}
4949
],
50+
"calls": [
51+
"setMailer"
52+
],
5053
"autowire": false,
5154
"autowiring_types": []
5255
}

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ definition_2
3030
- File: `/path/to/file`
3131
- Factory Service: `factory.service`
3232
- Factory Method: `get`
33+
- Call: `setMailer`
3334
- Tag: `tag1`
3435
- Attr1: val1
3536
- Attr2: val2

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
</definition>
88
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" file="/path/to/file">
99
<factory service="factory.service" method="get"/>
10+
<calls>
11+
<call method="setMailer"/>
12+
</calls>
1013
<tags>
1114
<tag name="tag1">
1215
<parameter name="attr1">val1</parameter>

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
]
3232
}
3333
],
34+
"calls": [
35+
"setMailer"
36+
],
3437
"autowire": false,
3538
"autowiring_types": []
3639
}

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ definition_2
1717
- File: `/path/to/file`
1818
- Factory Service: `factory.service`
1919
- Factory Method: `get`
20+
- Call: `setMailer`
2021
- Tag: `tag1`
2122
- Attr1: val1
2223
- Attr2: val2

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<container>
33
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" file="/path/to/file">
44
<factory service="factory.service" method="get"/>
5+
<calls>
6+
<call method="setMailer"/>
7+
</calls>
58
<tags>
69
<tag name="tag1">
710
<parameter name="attr1">val1</parameter>

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"shared": true,
99
"abstract": false,
1010
"file": "\/path\/to\/file",
11+
"calls": [
12+
"setMailer"
13+
],
1114
"factory_service": "factory.service",
1215
"factory_method": "get",
1316
"autowire": false,
@@ -23,6 +26,9 @@
2326
"shared": true,
2427
"abstract": false,
2528
"file": "\/path\/to\/file",
29+
"calls": [
30+
"setMailer"
31+
],
2632
"factory_service": "factory.service",
2733
"factory_method": "get",
2834
"autowire": false,

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ definition_2
1717
- File: `/path/to/file`
1818
- Factory Service: `factory.service`
1919
- Factory Method: `get`
20+
- Call: `setMailer`
2021
2122
2223
tag2
@@ -35,3 +36,4 @@ definition_2
3536
- File: `/path/to/file`
3637
- Factory Service: `factory.service`
3738
- Factory Method: `get`
39+
- Call: `setMailer`

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
<tag name="tag1">
44
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" file="/path/to/file">
55
<factory service="factory.service" method="get"/>
6+
<calls>
7+
<call method="setMailer"/>
8+
</calls>
69
</definition>
710
</tag>
811
<tag name="tag2">
912
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" file="/path/to/file">
1013
<factory service="factory.service" method="get"/>
14+
<calls>
15+
<call method="setMailer"/>
16+
</calls>
1117
</definition>
1218
</tag>
1319
</container>

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
]
3030
}
3131
],
32+
"calls": [
33+
"setMailer"
34+
],
3235
"autowire": false,
3336
"autowiring_types": []
3437
}

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
- File: `/path/to/file`
99
- Factory Service: `factory.service`
1010
- Factory Method: `get`
11+
- Call: `setMailer`
1112
- Tag: `tag1`
1213
- Attr1: val1
1314
- Attr2: val2
1415
- Tag: `tag1`
1516
- Attr3: val3
16-
- Tag: `tag2`
17+
- Tag: `tag2`

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Service ID -
55
Class Full\Qualified\Class2
66
Tags tag1 (attr1: val1, attr2: val2)tag1 (attr3: val3)tag2
7+
Calls setMailer
78
Public no
89
Synthetic yes
910
Lazy no

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<definition class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" file="/path/to/file">
33
<factory service="factory.service" method="get"/>
4+
<calls>
5+
<call method="setMailer"/>
6+
</calls>
47
<tags>
58
<tag name="tag1">
69
<parameter name="attr1">val1</parameter>

0 commit comments

Comments
 (0)