[FrameworkBundle] Allow custom services for validator mapping cache.

This commit is contained in:
Jakub Zalas 2014-12-13 20:05:40 +00:00
parent 98c8ec1cbc
commit 4cdcf109d3
2 changed files with 7 additions and 2 deletions

View File

@ -442,7 +442,12 @@ class Configuration implements ConfigurationInterface
->info('validation configuration')
->canBeEnabled()
->children()
->scalarNode('cache')->end()
->scalarNode('cache')
->beforeNormalization()
// Can be removed in 3.0, once ApcCache support is dropped
->ifString()->then(function ($v) { return 'apc' === $v ? 'validator.mapping.cache.apc' : $v; })
->end()
->end()
->booleanNode('enable_annotations')->defaultFalse()->end()
->arrayNode('static_method')
->defaultValue(array('loadValidatorMetadata'))

View File

@ -716,7 +716,7 @@ class FrameworkExtension extends Extension
'validator_'.hash('sha256', $container->getParameter('kernel.root_dir'))
);
$validatorBuilder->addMethodCall('setMetadataCache', array(new Reference('validator.mapping.cache.'.$config['cache'])));
$validatorBuilder->addMethodCall('setMetadataCache', array(new Reference($config['cache'])));
}
switch ($config['api']) {