From 81118f8d472e51fbab1538b4ed54671f73dbb3de Mon Sep 17 00:00:00 2001 From: Francis Besset Date: Thu, 14 Jul 2011 18:39:47 +0200 Subject: [PATCH] Deleted "name" element in the configuration of services --- DependencyInjection/Configuration.php | 4 +--- DependencyInjection/WebServiceExtension.php | 8 ++++---- README.markdown | 3 +-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 1dadea7..2f83de3 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -33,11 +33,9 @@ class Configuration $rootNode ->children() ->arrayNode('services') + ->useAttributeAsKey('name') ->prototype('array') ->children() - ->scalarNode('name') - ->isRequired() - ->end() ->scalarNode('namespace') ->isRequired() ->end() diff --git a/DependencyInjection/WebServiceExtension.php b/DependencyInjection/WebServiceExtension.php index b67e07a..c87aaa7 100644 --- a/DependencyInjection/WebServiceExtension.php +++ b/DependencyInjection/WebServiceExtension.php @@ -44,12 +44,12 @@ class WebServiceExtension extends Extension $config = $processor->process($configuration->getConfigTree(), $configs); - foreach($config['services'] as $serviceContextConfig) { - $this->createWebServiceContext($serviceContextConfig, $container); + foreach($config['services'] as $name => $serviceConfig) { + $this->createWebServiceContext($name, $serviceConfig, $container); } } - private function createWebServiceContext(array $config, ContainerBuilder $container) + private function createWebServiceContext($name, array $config, ContainerBuilder $container) { $bindingDependentArguments = array(1, 3, 4); $bindingSuffix = $this->bindingConfigToServiceSuffixMap[$config['binding']]; @@ -58,7 +58,7 @@ class WebServiceExtension extends Extension $contextPrototype = $container->getDefinition('webservice.context'); $contextPrototypeArguments = $contextPrototype->getArguments(); - $contextId = 'webservice.context.'.$config['name']; + $contextId = 'webservice.context.'.$name; $context = $container->setDefinition($contextId, new DefinitionDecorator('webservice.context')); $arguments = array(); diff --git a/README.markdown b/README.markdown index ee2f472..93d6f52 100644 --- a/README.markdown +++ b/README.markdown @@ -26,8 +26,7 @@ QuickStart web_service: services: - demoapi: - name: DemoApi + DemoApi: namespace: http://mysymfonyapp.com/ws/DemoApi/1.0/ binding: rpc-literal resource: "@AcmeDemoBundle/Controller/DemoController.php"