Added user_agent option

This commit is contained in:
Francis Besset 2011-10-08 22:04:18 +02:00
parent 1d9bd2cdd3
commit 6d2e9d7634
3 changed files with 13 additions and 11 deletions

View File

@ -84,18 +84,21 @@ class BeSimpleSoapExtension extends Extension
$definition->replaceArgument(0, $options['wsdl']); $definition->replaceArgument(0, $options['wsdl']);
if (isset($options['cache_type'])) {
$options['cache_type'] = $this->getCacheType($options['cache_type']);
$defOptions = $container $defOptions = $container
->getDefinition('besimple.soap.client') ->getDefinition('besimple.soap.client')
->getArgument(1); ->getArgument(1);
$defOptions['cache_type'] = $options['cache_type']; foreach (array('cache_type', 'namespace', 'user_agent') as $key) {
$defOptions['namespace'] = $options['namespace']; if (isset($options[$key])) {
$defOptions[$key] = $options[$key];
}
}
if (isset($defOptions['cache_type'])) {
$$defOptions['cache_type'] = $this->getCacheType($defOptions['cache_type']);
}
$definition->replaceArgument(1, $defOptions); $definition->replaceArgument(1, $defOptions);
}
if (!empty($options['classmap'])) { if (!empty($options['classmap'])) {
$classmap = $this->createClientClassmap($client, $options['classmap'], $container); $classmap = $this->createClientClassmap($client, $options['classmap'], $container);

View File

@ -74,7 +74,8 @@ class Configuration
->prototype('array') ->prototype('array')
->children() ->children()
->scalarNode('wsdl')->isRequired()->end() ->scalarNode('wsdl')->isRequired()->end()
->scalarNode('namespace')->defaultNull()->end() ->scalarNode('namespace')->end()
->scalarNode('user_agent')->end()
->scalarNode('cache_type') ->scalarNode('cache_type')
->validate() ->validate()
->ifNotInArray($this->cacheTypes) ->ifNotInArray($this->cacheTypes)

View File

@ -13,8 +13,6 @@
<argument /> <!-- wsdl URI --> <argument /> <!-- wsdl URI -->
<argument type="collection"> <argument type="collection">
<argument key="debug">%kernel.debug%</argument> <argument key="debug">%kernel.debug%</argument>
<argument key="cache_type">null</argument>
<argument key="namespace">null</argument>
</argument> </argument>
<argument type="service" id="besimple.soap.classmap" /> <argument type="service" id="besimple.soap.classmap" />
<argument type="service" id="besimple.soap.converter.collection" /> <argument type="service" id="besimple.soap.converter.collection" />