Skip to content

Commit

Permalink
adds two convenience methods for optional configuration sections
Browse files Browse the repository at this point in the history
  • Loading branch information
schmittjoh committed Oct 6, 2012
1 parent ef78984 commit ec9673b
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,11 @@ private function addFormSection(ArrayNodeDefinition $rootNode)
->children()
->arrayNode('form')
->info('form configuration')
->canBeUnset()
->treatNullLike(array('enabled' => true))
->treatTrueLike(array('enabled' => true))
->children()
->booleanNode('enabled')->defaultTrue()->end()
->end()
->canBeDisabled()
->end()
->arrayNode('csrf_protection')
->canBeUnset()
->treatNullLike(array('enabled' => true))
->treatTrueLike(array('enabled' => true))
->canBeDisabled()
->children()
->booleanNode('enabled')->defaultTrue()->end()
->scalarNode('field_name')->defaultValue('_token')->end()
->end()
->end()
Expand All @@ -114,12 +106,7 @@ private function addEsiSection(ArrayNodeDefinition $rootNode)
->children()
->arrayNode('esi')
->info('esi configuration')
->canBeUnset()
->treatNullLike(array('enabled' => true))
->treatTrueLike(array('enabled' => true))
->children()
->booleanNode('enabled')->defaultTrue()->end()
->end()
->canBeDisabled()
->end()
->end()
;
Expand All @@ -131,11 +118,10 @@ private function addProfilerSection(ArrayNodeDefinition $rootNode)
->children()
->arrayNode('profiler')
->info('profiler configuration')
->canBeUnset()
->canBeDisabled()
->children()
->booleanNode('only_exceptions')->defaultFalse()->end()
->booleanNode('only_master_requests')->defaultFalse()->end()
->booleanNode('enabled')->defaultTrue()->end()
->scalarNode('dsn')->defaultValue('file:%kernel.cache_dir%/profiler')->end()
->scalarNode('username')->defaultValue('')->end()
->scalarNode('password')->defaultValue('')->end()
Expand Down Expand Up @@ -363,11 +349,8 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode)
->children()
->arrayNode('translator')
->info('translator configuration')
->canBeUnset()
->treatNullLike(array('enabled' => true))
->treatTrueLike(array('enabled' => true))
->canBeDisabled()
->children()
->booleanNode('enabled')->defaultTrue()->end()
->scalarNode('fallback')->defaultValue('en')->end()
->end()
->end()
Expand All @@ -381,11 +364,8 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
->children()
->arrayNode('validation')
->info('validation configuration')
->canBeUnset()
->treatNullLike(array('enabled' => true))
->treatTrueLike(array('enabled' => true))
->canBeDisabled()
->children()
->booleanNode('enabled')->defaultTrue()->end()
->scalarNode('cache')->end()
->booleanNode('enable_annotations')->defaultFalse()->end()
->end()
Expand Down

0 comments on commit ec9673b

Please sign in to comment.