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.
This commit is contained in:
Jeremy Mikola 2011-12-28 17:51:07 -05:00
parent 62b3d94f8e
commit d0fdebb7d1

View file

@ -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()