[FrameworkBundle] Autowiring support for debug:container

This commit is contained in:
Kévin Dunglas 2015-11-03 15:44:08 -08:00
parent 18913e15d5
commit 9c3b910849
32 changed files with 156 additions and 82 deletions

View File

@ -228,6 +228,16 @@ class JsonDescriptor extends Descriptor
}
$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)) {

View File

@ -195,6 +195,14 @@ class MarkdownDescriptor extends Descriptor
$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().'`';
}

View File

@ -288,6 +288,19 @@ class TextDescriptor extends Descriptor
}
$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() : '-');
}

View File

@ -373,6 +373,11 @@ class XmlDescriptor extends Descriptor
$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) {

View File

@ -14,7 +14,9 @@
"factory_method": "get",
"tags": [
]
],
"autowire": false,
"autowiring_types": []
}
},
"aliases": {

View File

@ -15,6 +15,7 @@ definition_1
- Shared: yes
- Synchronized: no
- Abstract: yes
- Autowired: no
- Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get`

View File

@ -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"/>

View File

@ -14,7 +14,9 @@
"factory_method": "get",
"tags": [
]
],
"autowire": false,
"autowiring_types": []
},
"definition_2": {
"class": "Full\\Qualified\\Class2",
@ -48,7 +50,9 @@
]
}
]
],
"autowire": false,
"autowiring_types": []
}
},
"aliases": {

View File

@ -15,6 +15,7 @@ definition_1
- Shared: yes
- Synchronized: no
- Abstract: yes
- Autowired: no
- Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get`
@ -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`

View File

@ -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">

View File

@ -32,7 +32,9 @@
]
}
]
],
"autowire": false,
"autowiring_types": []
}
},
"aliases": [

View File

@ -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`

View File

@ -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">

View File

@ -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": [
@ -26,7 +28,9 @@
"abstract": false,
"file": "\/path\/to\/file",
"factory_service": "factory.service",
"factory_method": "get"
"factory_method": "get",
"autowire": false,
"autowiring_types": []
}
]
}

View File

@ -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`
@ -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`

View File

@ -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>

View File

@ -12,5 +12,7 @@
"factory_method": "get",
"tags": [
]
],
"autowire": false,
"autowiring_types": []
}

View File

@ -6,5 +6,6 @@
- Shared: yes
- Synchronized: no
- Abstract: yes
- Autowired: no
- Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get`

View File

@ -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
------------------ -----------------------------

View File

@ -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>

View File

@ -30,5 +30,7 @@
]
}
]
],
"autowire": false,
"autowiring_types": []
}

View File

@ -6,6 +6,7 @@
- Shared: yes
- Synchronized: no
- Abstract: no
- Autowired: no
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`

View File

@ -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
------------------ -------------------------------------------------------

View File

@ -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">

View File

@ -12,5 +12,7 @@
"factory_method": "get",
"tags": [
]
],
"autowire": false,
"autowiring_types": []
}

View File

@ -6,5 +6,6 @@
- Shared: yes
- Synchronized: yes
- Abstract: yes
- Autowired: no
- Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get`

View File

@ -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
------------------ -----------------------------

View File

@ -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=""/>

View File

@ -30,5 +30,7 @@
]
}
]
],
"autowire": false,
"autowiring_types": []
}

View File

@ -6,6 +6,7 @@
- Shared: yes
- Synchronized: no
- Abstract: no
- Autowired: no
- File: `/path/to/file`
- Factory Service: `factory.service`
- Factory Method: `get`

View File

@ -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
------------------ -------------------------------------------------------

View File

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