Permalink
Browse files

Configuration

  • Loading branch information...
1 parent 0c7bb19 commit f33d8e8aa9fd2df8bc7909b8821e11134325d8a3 @joshiausdemwald committed Jun 12, 2011
@@ -58,17 +58,17 @@ public function load(array $configs, ContainerBuilder $container)
$container->setParameter('autowiring.config.enabled', $config['enabled']);
- $container->setParameter('autowiring.config.build_definitions', $config['build_definitions']['enabled']);
+ $container->setParameter('autowiring.config.build_definitions.enabled', $config['build_definitions']['enabled']);
$container->setParameter('autowiring.config.build_definitions.paths', $config['build_definitions']['paths']);
- $container->setParameter('autowiring.config.property_injection', $config['property_injection']['enabled']);
- $container->setParameter('autowiring.config.property_injection.wire_by_name', $config['property_injection']['wire_by_name']['enabled']);
- $container->setParameter('autowiring.config.property_injection.name_suffix', $config['property_injection']['wire_by_name']['name_suffix']);
+ $container->setParameter('autowiring.config.property_injection.enabled', $config['property_injection']['enabled']);
+ $container->setParameter('autowiring.config.property_injection.wire_by_name', $config['property_injection']['wire_by_name']);
+ $container->setParameter('autowiring.config.property_injection.name_suffix', $config['property_injection']['name_suffix']);
- $container->setParameter('autowiring.config.setter_injection', $config['setter_injection']['enabled']);
+ $container->setParameter('autowiring.config.setter_injection.enabled', $config['setter_injection']['enabled']);
$container->setParameter('autowiring.config.setter_injection.wire_by_type', $config['setter_injection']['wire_by_type']);
- $container->setParameter('autowiring.config.constructor_injection', $config['constructor_injection']['enabled']);
+ $container->setParameter('autowiring.config.constructor_injection.enabled', $config['constructor_injection']['enabled']);
$container->setParameter('autowiring.config.constructor_injection.wire_by_type', $config['constructor_injection']['wire_by_type']);
$this->loadServices($container, $bundles);
@@ -80,7 +80,7 @@ public function load(array $configs, ContainerBuilder $container)
*/
public function loadServices(ContainerBuilder $container, array $bundles)
{
- if($container->getParameter('autowiring.config.enabled') && $container->getParameter('autowiring.config.build_definitions'))
+ if($container->getParameter('autowiring.config.enabled') && $container->getParameter('autowiring.config.build_definitions.enabled'))
{
$serviceBuilder = new ServiceBuilder($container);
@@ -157,16 +157,8 @@ public function getConfigTreeBuilder()
->treatFalseLike(array('enabled' => false))
->children()
->booleanNode('enabled')->defaultTrue()->end()
- ->arrayNode('wire_by_name')
- ->addDefaultsIfNotSet()
- ->canBeUnset()
- ->treatNullLike(array('enabled' => true))
- ->treatFalseLike(array('enabled' => false))
- ->children()
- ->booleanNode('enabled')->defaultTrue()->end()
- ->scalarNode('name_suffix')->defaultValue('Service')->end()
- ->end()
- ->end()
+ ->booleanNode('wire_by_name')->defaultTrue()->end()
+ ->scalarNode('name_suffix')->defaultValue('Service')->end()
->end()
->end()
->arrayNode('setter_injection')
@@ -5,7 +5,7 @@
targetNamespace="http://ifschleife.de/schema/dic/autowiring"
elementFormDefault="qualified"
>
- <xsd:element name="config" type="config" minOccurs="0" maxOccurs="1">
+ <xsd:element name="config" type="config">
<xsd:complexType>
<xsd:attribute ref="enabled" />
<xsd:sequence>
@@ -42,59 +42,47 @@
</xsd:element>
<xsd:attributeGroup name="pathAttributes">
- <xsd:attribute name="filename-pattern" type="string" />
- <xsd:attribute name="recursive" type="boolean" default="true" />
- <xsd:attribute name="name" type="string" />
+ <xsd:attribute name="filename-pattern" type="xsd:string" />
+ <xsd:attribute name="recursive" type="xsd:boolean" default="true" />
+ <xsd:attribute name="name" type="xsd:string" />
</xsd:attributeGroup>
<xsd:element name="property-injection">
<xsd:complexType>
- <xsd:attribute ref="enabled" />
- <xsd:sequence>
- <xsd:element ref="wire-by-name" minOccurs="0" maxOccurs="1" />
- </xsd:sequence>
+ <xsd:attributeGroup ref="propertyInjectionAttributes" />
</xsd:complexType>
</xsd:element>
- <xsd:element name="wire-by-name">
- <xsd:complexType>
- <xsd:element ref="enabled" minOccurs="0" maxOccurs="1" />
- <xsd:sequence>
- <xsd:element ref="name-suffix" minOccurs="0" maxOccurs="1" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
+ <xsd:attributeGroup name="propertyInjectionAttributes">
+ <xsd:attribute ref="enabled" />
+ <xsd:attribute name="wire-by-name" default="true" type="xsd:boolean" />
+ <xsd:attribute name="name-suffix" default="Service" type="name-suffix" />
+ </xsd:attributeGroup>
- <xsd:element name="name-suffix">
- <xsd:simpleType name="name-suffix">
- <xsd:restriction base="xsd:string">
- <xsd:minLength value="1" />
- <xsd:maxLength value="50"/>
- <xsd:pattern value="[A-Z][a-z]*" />
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:element>
+ <xsd:simpleType name="name-suffix">
+ <xsd:restriction base="xsd:string">
+ <xsd:minLength value="1" />
+ <xsd:maxLength value="50"/>
+ <xsd:pattern value="[A-Z][a-z]*" />
+ </xsd:restriction>
+ </xsd:simpleType>
<xsd:element name="setter-injection">
<xsd:complexType>
<xsd:attribute ref="enabled" />
- <xsd:sequence>
- <xsd:element ref="wire-by-type" minOccurs="0" maxOccurs="1"/>
- </xsd:sequence>
+ <xsd:attribute ref="wire-by-type" />
</xsd:complexType>
</xsd:element>
<xsd:element name="constructor-injection">
<xsd:complexType>
<xsd:attribute ref="enabled" />
- <xsd:sequence>
- <xsd:element ref="wire-by-type" minOccurs="0" maxOccurs="1" />
- </xsd:sequence>
+ <xsd:attribute ref="wire-by-type" />
</xsd:complexType>
</xsd:element>
<xsd:attribute name="enabled" type="xsd:boolean" default="true" />
- <xsd:element name="wire-by-type" type="xsd:boolean" default="true" />
+ <xsd:attribute name="wire-by-type" type="xsd:boolean" default="true" />
</xsd:schema>

0 comments on commit f33d8e8

Please sign in to comment.