Navigation Menu

Skip to content

Commit

Permalink
[FrameworkBundle] Autowiring support for debug:container
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Nov 6, 2015
1 parent 18913e1 commit 9c3b910
Show file tree
Hide file tree
Showing 32 changed files with 156 additions and 82 deletions.
Expand Up @@ -228,6 +228,16 @@ private function getContainerDefinitionData(Definition $definition, $omitTags =
}

$data['abstract'] = $definition->isAbstract();

if (method_exists($definition, 'isAutowired')) {
$data['autowire'] = $definition->isAutowired();

$data['autowiring_types'] = array();
foreach ($definition->getAutowiringTypes() as $autowiringType) {
$data['autowiring_types'][] = $autowiringType;
}
}

$data['file'] = $definition->getFile();

if ($definition->getFactoryClass(false)) {
Expand Down
Expand Up @@ -195,6 +195,14 @@ protected function describeContainerDefinition(Definition $definition, array $op

$output .= "\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no');

if (method_exists($definition, 'isAutowired')) {
$output .= "\n".'- Autowired: '.($definition->isAutowired() ? 'yes' : 'no');

foreach ($definition->getAutowiringTypes() as $autowiringType) {
$output .= "\n".'- Autowiring Type: `'.$autowiringType.'`';
}
}

if ($definition->getFile()) {
$output .= "\n".'- File: `'.$definition->getFile().'`';
}
Expand Down
Expand Up @@ -288,6 +288,19 @@ protected function describeContainerDefinition(Definition $definition, array $op
}
$tableRows[] = array('Abstract', $definition->isAbstract() ? 'yes' : 'no');

if (method_exists($definition, 'isAutowired')) {
$tableRows[] = array('Autowired', $definition->isAutowired() ? 'yes' : 'no');

$autowiringTypes = $definition->getAutowiringTypes();
if (count($autowiringTypes)) {
$autowiringTypesInformation = implode(', ', $autowiringTypes);
} else {
$autowiringTypesInformation = '-';
}

$tableRows[] = array('Autowiring Types', $autowiringTypesInformation);
}

if ($definition->getFile()) {
$tableRows[] = array('Required File', $definition->getFile() ? $definition->getFile() : '-');
}
Expand Down
Expand Up @@ -373,6 +373,11 @@ private function getContainerDefinitionDocument(Definition $definition, $id = nu
$serviceXML->setAttribute('synchronized', $definition->isSynchronized(false) ? 'true' : 'false');
}
$serviceXML->setAttribute('abstract', $definition->isAbstract() ? 'true' : 'false');

if (method_exists($definition, 'isAutowired')) {
$serviceXML->setAttribute('autowired', $definition->isAutowired() ? 'true' : 'false');
}

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

if (!$omitTags) {
Expand Down
Expand Up @@ -14,7 +14,9 @@
"factory_method": "get",
"tags": [

]
],
"autowire": false,
"autowiring_types": []
}
},
"aliases": {
Expand Down
Expand Up @@ -15,6 +15,7 @@ definition_1
- Shared: yes
- Synchronized: no
- Abstract: yes
- Autowired: no
- Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get`
Expand Down
Expand Up @@ -2,7 +2,7 @@
<container>
<alias id="alias_1" service="service_1" public="true"/>
<alias id="alias_2" service="service_2" public="false"/>
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="false" abstract="true" file="">
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="false" abstract="true" autowired="false" file="">
<factory class="Full\Qualified\FactoryClass" method="get"/>
</definition>
<service id="service_container" class="Symfony\Component\DependencyInjection\ContainerBuilder"/>
Expand Down
Expand Up @@ -14,7 +14,9 @@
"factory_method": "get",
"tags": [

]
],
"autowire": false,
"autowiring_types": []
},
"definition_2": {
"class": "Full\\Qualified\\Class2",
Expand Down Expand Up @@ -48,7 +50,9 @@

]
}
]
],
"autowire": false,
"autowiring_types": []
}
},
"aliases": {
Expand Down
Expand Up @@ -15,6 +15,7 @@ definition_1
- Shared: yes
- Synchronized: no
- Abstract: yes
- Autowired: no
- Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get`
Expand All @@ -29,6 +30,7 @@ definition_2
- Shared: yes
- Synchronized: no
- Abstract: no
- Autowired: no
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`
Expand Down
Expand Up @@ -2,10 +2,10 @@
<container>
<alias id="alias_1" service="service_1" public="true"/>
<alias id="alias_2" service="service_2" public="false"/>
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="false" abstract="true" file="">
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="false" abstract="true" autowired="false" file="">
<factory class="Full\Qualified\FactoryClass" method="get"/>
</definition>
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" file="/path/to/file">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" autowired="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
<tags>
<tag name="tag1">
Expand Down
Expand Up @@ -32,7 +32,9 @@

]
}
]
],
"autowire": false,
"autowiring_types": []
}
},
"aliases": [
Expand Down
Expand Up @@ -15,6 +15,7 @@ definition_2
- Shared: yes
- Synchronized: no
- Abstract: no
- Autowired: no
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<container>
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" file="/path/to/file">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" autowired="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
<tags>
<tag name="tag1">
Expand Down
Expand Up @@ -11,7 +11,9 @@
"abstract": false,
"file": "\/path\/to\/file",
"factory_service": "factory.service",
"factory_method": "get"
"factory_method": "get",
"autowire": false,
"autowiring_types": []
}
],
"tag2": [
Expand All @@ -26,7 +28,9 @@
"abstract": false,
"file": "\/path\/to\/file",
"factory_service": "factory.service",
"factory_method": "get"
"factory_method": "get",
"autowire": false,
"autowiring_types": []
}
]
}
Expand Up @@ -15,6 +15,7 @@ definition_2
- Shared: yes
- Synchronized: no
- Abstract: no
- Autowired: no
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`
Expand All @@ -34,6 +35,7 @@ definition_2
- Shared: yes
- Synchronized: no
- Abstract: no
- Autowired: no
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<container>
<tag name="tag1">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" file="/path/to/file">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" autowired="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
</definition>
</tag>
<tag name="tag2">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" file="/path/to/file">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" autowired="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
</definition>
</tag>
Expand Down
Expand Up @@ -12,5 +12,7 @@
"factory_method": "get",
"tags": [

]
],
"autowire": false,
"autowiring_types": []
}
Expand Up @@ -6,5 +6,6 @@
- Shared: yes
- Synchronized: no
- Abstract: yes
- Autowired: no
- Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get`
@@ -1,15 +1,17 @@
---------------- -----------------------------
Option Value
---------------- -----------------------------
Service ID -
Class Full\Qualified\Class1
Tags -
Scope container
Public yes
Synthetic no
Lazy yes
Synchronized no
Abstract yes
Factory Class Full\Qualified\FactoryClass
Factory Method get
---------------- -----------------------------
------------------ -----------------------------
Option Value
------------------ -----------------------------
Service ID -
Class Full\Qualified\Class1
Tags -
Scope container
Public yes
Synthetic no
Lazy yes
Synchronized no
Abstract yes
Autowired no
Autowiring Types -
Factory Class Full\Qualified\FactoryClass
Factory Method get
------------------ -----------------------------
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<definition class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="false" abstract="true" file="">
<definition class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="false" abstract="true" autowired="false" file="">
<factory class="Full\Qualified\FactoryClass" method="get"/>
</definition>
Expand Up @@ -30,5 +30,7 @@

]
}
]
],
"autowire": false,
"autowiring_types": []
}
Expand Up @@ -6,6 +6,7 @@
- Shared: yes
- Synchronized: no
- Abstract: no
- Autowired: no
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`
Expand Down
@@ -1,16 +1,18 @@
----------------- -------------------------------------------------------
Option Value
----------------- -------------------------------------------------------
Service ID -
Class Full\Qualified\Class2
Tags tag1 (attr1: val1, attr2: val2)tag1 (attr3: val3)tag2
Scope container
Public no
Synthetic yes
Lazy no
Synchronized no
Abstract no
Required File /path/to/file
Factory Service factory.service
Factory Method get
----------------- -------------------------------------------------------
------------------ -------------------------------------------------------
Option Value
------------------ -------------------------------------------------------
Service ID -
Class Full\Qualified\Class2
Tags tag1 (attr1: val1, attr2: val2)tag1 (attr3: val3)tag2
Scope container
Public no
Synthetic yes
Lazy no
Synchronized no
Abstract no
Autowired no
Autowiring Types -
Required File /path/to/file
Factory Service factory.service
Factory Method get
------------------ -------------------------------------------------------
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<definition class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" file="/path/to/file">
<definition class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" autowired="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
<tags>
<tag name="tag1">
Expand Down
Expand Up @@ -12,5 +12,7 @@
"factory_method": "get",
"tags": [

]
],
"autowire": false,
"autowiring_types": []
}
Expand Up @@ -6,5 +6,6 @@
- Shared: yes
- Synchronized: yes
- Abstract: yes
- Autowired: no
- Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get`
@@ -1,15 +1,17 @@
---------------- -----------------------------
Option Value
---------------- -----------------------------
Service ID -
Class Full\Qualified\Class1
Tags -
Scope container
Public yes
Synthetic no
Lazy yes
Synchronized yes
Abstract yes
Factory Class Full\Qualified\FactoryClass
Factory Method get
---------------- -----------------------------
------------------ -----------------------------
Option Value
------------------ -----------------------------
Service ID -
Class Full\Qualified\Class1
Tags -
Scope container
Public yes
Synthetic no
Lazy yes
Synchronized yes
Abstract yes
Autowired no
Autowiring Types -
Factory Class Full\Qualified\FactoryClass
Factory Method get
------------------ -----------------------------
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<definition class="Full\Qualified\Class1" factory-class="Full\Qualified\FactoryClass" factory-method="get" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="true" abstract="true" file=""/>
<definition class="Full\Qualified\Class1" factory-class="Full\Qualified\FactoryClass" factory-method="get" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="true" abstract="true" autowired="false" file=""/>

0 comments on commit 9c3b910

Please sign in to comment.