Added besimple.soap.classmap service
This commit is contained in:
parent
94a8a8fec1
commit
1d9bd2cdd3
|
@ -96,8 +96,27 @@ class BeSimpleSoapExtension extends Extension
|
|||
|
||||
$definition->replaceArgument(1, $defOptions);
|
||||
}
|
||||
|
||||
if (!empty($options['classmap'])) {
|
||||
$classmap = $this->createClientClassmap($client, $options['classmap'], $container);
|
||||
$definition->replaceArgument(2, new Reference($classmap));
|
||||
} else {
|
||||
$definition->replaceArgument(2, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function createClientClassmap($client, array $classmap, ContainerBuilder $container)
|
||||
{
|
||||
$definition = new DefinitionDecorator('besimple.soap.classmap');
|
||||
$context = $container->setDefinition(sprintf('besimple.soap.classmap.%s', $client), $definition);
|
||||
|
||||
$definition->setMethodCalls(array(
|
||||
array('set', array($classmap)),
|
||||
));
|
||||
|
||||
return sprintf('besimple.soap.classmap.%s', $client);
|
||||
}
|
||||
|
||||
private function createWebServiceContext(array $config, ContainerBuilder $container)
|
||||
{
|
||||
|
|
|
@ -81,6 +81,10 @@ class Configuration
|
|||
->thenInvalid(sprintf('The cache type has to be either %s', implode(', ', $this->cacheTypes)))
|
||||
->end()
|
||||
->end()
|
||||
->arrayNode('classmap')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('scalar')
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
<parameters>
|
||||
<parameter key="besimple.soap.client.class">BeSimple\SoapClient\SoapClient</parameter>
|
||||
<parameter key="besimple.soap.classmap.class">BeSimple\SoapCommon\Classmap</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
|
@ -15,9 +16,12 @@
|
|||
<argument key="cache_type">null</argument>
|
||||
<argument key="namespace">null</argument>
|
||||
</argument>
|
||||
<argument type="service" id="besimple.soap.classmap" />
|
||||
<argument type="service" id="besimple.soap.converter.collection" />
|
||||
<argument type="service" id="besimple.soap.cache" />
|
||||
</service>
|
||||
|
||||
<service id="besimple.soap.classmap" class="%besimple.soap.classmap.class%" abstract="true" />
|
||||
</services>
|
||||
|
||||
</container>
|
||||
|
|
Loading…
Reference in New Issue