2011-03-26 16:43:41 +01:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* This file is part of the WebServiceBundle.
|
|
|
|
*
|
|
|
|
* (c) Christian Kerl <christian-kerl@web.de>
|
|
|
|
*
|
|
|
|
* This source file is subject to the MIT license that is bundled
|
|
|
|
* with this source code in the file LICENSE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Bundle\WebServiceBundle\DependencyInjection;
|
|
|
|
|
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WebServiceExtension configuration structure.
|
|
|
|
*
|
|
|
|
* @author Christian Kerl <christian-kerl@web.de>
|
|
|
|
*/
|
|
|
|
class Configuration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Generates the configuration tree.
|
|
|
|
*
|
|
|
|
* @return \Symfony\Component\Config\Definition\ArrayNode The config tree
|
|
|
|
*/
|
|
|
|
public function getConfigTree()
|
|
|
|
{
|
|
|
|
$treeBuilder = new TreeBuilder();
|
2011-04-07 21:49:01 +02:00
|
|
|
$rootNode = $treeBuilder->root('web_service');
|
2011-03-26 16:43:41 +01:00
|
|
|
|
|
|
|
$rootNode
|
|
|
|
->children()
|
2011-04-07 21:49:01 +02:00
|
|
|
->arrayNode('services')
|
2011-07-14 18:39:47 +02:00
|
|
|
->useAttributeAsKey('name')
|
2011-04-07 21:49:01 +02:00
|
|
|
->prototype('array')
|
|
|
|
->children()
|
|
|
|
->scalarNode('namespace')
|
|
|
|
->isRequired()
|
|
|
|
->end()
|
|
|
|
->scalarNode('resource')
|
|
|
|
->defaultValue('*')
|
|
|
|
->end()
|
|
|
|
->scalarNode('resource_type')
|
|
|
|
->defaultValue('annotation')
|
|
|
|
->end()
|
|
|
|
->scalarNode('binding')
|
|
|
|
->defaultValue('document-wrapped')
|
|
|
|
->validate()
|
|
|
|
->ifNotInArray(array('rpc-literal', 'document-wrapped'))
|
|
|
|
->thenInvalid("Service binding style has to be either 'rpc-literal' or 'document-wrapped'")
|
|
|
|
->end()
|
|
|
|
->end()
|
|
|
|
->end()
|
|
|
|
->end()
|
2011-03-26 16:43:41 +01:00
|
|
|
->end()
|
|
|
|
;
|
|
|
|
|
|
|
|
return $treeBuilder->buildTree();
|
|
|
|
}
|
2011-07-14 17:45:03 +02:00
|
|
|
}
|