From d0fdebb7d1ff779b3ddc817a42e2ce5fe7e790f6 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 28 Dec 2011 17:51:07 -0500 Subject: [PATCH] Ensure persistence.driver option exists before validating The driver option is not required by the configuration, so we should check for it the validation functions. If type_prototype is being used, there is a legitimate case where type definitions would not specify a driver. Likewise, the type_prototype may not specify the driver. If we wish to validate that a driver has been specified for a type, we'll have to do that in the extension class after loading the configuration and merging in prototypes. --- DependencyInjection/Configuration.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 896604c..d44ebef 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -75,9 +75,9 @@ class Configuration ->children() ->arrayNode('persistence') ->validate() - ->ifTrue(function($v) { return 'propel' === $v['driver'] && isset($v['listener']); }) + ->ifTrue(function($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['listener']); }) ->thenInvalid('Propel doesn\'t support listeners') - ->ifTrue(function($v) { return 'propel' === $v['driver'] && isset($v['repository']); }) + ->ifTrue(function($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['repository']); }) ->thenInvalid('Propel doesn\'t support the "repository" parameter') ->end() ->children() @@ -150,9 +150,9 @@ class Configuration ->children() ->arrayNode('persistence') ->validate() - ->ifTrue(function($v) { return 'propel' === $v['driver'] && isset($v['listener']); }) + ->ifTrue(function($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['listener']); }) ->thenInvalid('Propel doesn\'t support listeners') - ->ifTrue(function($v) { return 'propel' === $v['driver'] && isset($v['repository']); }) + ->ifTrue(function($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['repository']); }) ->thenInvalid('Propel doesn\'t support the "repository" parameter') ->end() ->children()