Added the possibility to choice an other type cache for a client

This commit is contained in:
Francis Besset
2011-09-04 02:42:53 +02:00
parent 1a4e9246db
commit 2ea1704a1e
3 changed files with 41 additions and 19 deletions

View File

@ -23,6 +23,8 @@ use Symfony\Component\Config\Definition\Builder\TreeBuilder;
*/
class Configuration
{
private $cacheTypes = array('none', 'disk', 'memory', 'disk_memory');
/**
* Generates the configuration tree.
*
@ -46,12 +48,13 @@ class Configuration
$rootNode
->children()
->arrayNode('cache')
->addDefaultsIfNotSet()
->children()
->scalarNode('type')
->defaultValue('disk')
->validate()
->ifNotInArray(array('none', 'disk', 'memory', 'disk_memory'))
->thenInvalid('The cache type has to be either "none", "disk", "memory" or "disk_memory"')
->ifNotInArray($this->cacheTypes)
->thenInvalid(sprintf('The cache type has to be either %s', implode(', ', $this->cacheTypes)))
->end()
->end()
->scalarNode('lifetime')->defaultNull()->end()
@ -73,6 +76,12 @@ class Configuration
->scalarNode('wsdl')
->isRequired()
->end()
->scalarNode('cache_wsdl')
->validate()
->ifNotInArray($this->cacheTypes)
->thenInvalid(sprintf('The cache type has to be either %s', implode(', ', $this->cacheTypes)))
->end()
->end()
->end()
->end()
->end()