vendor/pixassociates/sortable-behavior-bundle/Pix/SortableBehaviorBundle/DependencyInjection/Configuration.php line 31

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the pixSortableBehaviorBundle.
  4.  *
  5.  * (c) Nicolas Ricci <nicolas.ricci@gmail.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Pix\SortableBehaviorBundle\DependencyInjection;
  11. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  12. use Symfony\Component\Config\Definition\ConfigurationInterface;
  13. /**
  14.  * This is the class that validates and merges configuration from your app/config files
  15.  *
  16.  * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
  17.  */
  18. class Configuration implements ConfigurationInterface
  19. {
  20.     /**
  21.      * {@inheritDoc}
  22.      */
  23.     public function getConfigTreeBuilder()
  24.     {
  25.         $supportedDrivers = array('orm''mongodb');
  26.         $treeBuilder = new TreeBuilder();
  27.         $rootNode $treeBuilder->root('pix_sortable_behavior');
  28.         $rootNode
  29.             ->children()
  30.             ->scalarNode('db_driver')
  31.                 ->info(sprintf(
  32.                     'These following drivers are supported: %s',
  33.                     implode(', '$supportedDrivers)
  34.                 ))
  35.                 ->validate()
  36.                     ->ifNotInArray($supportedDrivers)
  37.                     ->thenInvalid('The driver "%s" is not supported. Please choose one of ('.implode(', '$supportedDrivers).')')
  38.                 ->end()
  39.                 ->cannotBeOverwritten()
  40.                 ->cannotBeEmpty()
  41.                 ->defaultValue('orm')
  42.             ->end()
  43.             ->arrayNode('position_field')
  44.                 ->addDefaultsIfNotSet()
  45.                 ->children()
  46.                     ->scalarNode('default')
  47.                         ->defaultValue('position')
  48.                     ->end()
  49.                     ->arrayNode('entities')
  50.                         ->prototype('scalar')->end()
  51.                     ->end()
  52.                 ->end()
  53.             ->end()
  54.             ->arrayNode('sortable_groups')
  55.                 ->addDefaultsIfNotSet()
  56.                 ->children()
  57.                     ->arrayNode('entities')
  58.                         ->useAttributeAsKey('name')
  59.                         ->prototype('variable')
  60.                         ->end()
  61.                     ->end()
  62.                 ->end()
  63.             ->end()
  64.         ;
  65.         return $treeBuilder;
  66.     }
  67. }