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,19 +84,22 @@ class BeSimpleSoapExtension extends Extension
$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')
->getArgument(1);
$defOptions['cache_type'] = $options['cache_type'];
$defOptions['namespace'] = $options['namespace'];
$definition->replaceArgument(1, $defOptions);
foreach (array('cache_type', 'namespace', 'user_agent') as $key) {
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);
if (!empty($options['classmap'])) {
$classmap = $this->createClientClassmap($client, $options['classmap'], $container);
$definition->replaceArgument(2, new Reference($classmap));

View File

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

View File

@ -13,8 +13,6 @@
<argument /> <!-- wsdl URI -->
<argument type="collection">
<argument key="debug">%kernel.debug%</argument>
<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" />