vendor/sonata-project/exporter/src/Bridge/Symfony/DependencyInjection/Configuration.php line 30

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sonata Project package.
  4.  *
  5.  * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  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 Sonata\Exporter\Bridge\Symfony\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.  * @author GrĂ©goire Paris <postmaster@greg0ire.fr>
  17.  */
  18. final class Configuration implements ConfigurationInterface
  19. {
  20.     /**
  21.      * {@inheritdoc}
  22.      */
  23.     public function getConfigTreeBuilder()
  24.     {
  25.         $treeBuilder = new TreeBuilder();
  26.         $rootNode $treeBuilder->root('sonata_exporter');
  27.         $rootNode
  28.             ->children()
  29.                 ->arrayNode('exporter')
  30.                     ->addDefaultsIfNotSet()
  31.                     ->children()
  32.                         ->arrayNode('default_writers')
  33.                             ->defaultValue(['csv''json''xls''xml'])
  34.                             ->prototype('scalar')->end()
  35.                         ->end()
  36.                     ->end()
  37.                 ->end()
  38.                 ->arrayNode('writers')
  39.                     ->addDefaultsIfNotSet()
  40.                     ->children()
  41.                         ->arrayNode('csv')
  42.                             ->addDefaultsIfNotSet()
  43.                             ->children()
  44.                                 ->scalarNode('filename')
  45.                                     ->defaultValue('php://output')
  46.                                     ->info('path to the output file')
  47.                                 ->end()
  48.                                 ->scalarNode('delimiter')
  49.                                     ->defaultValue(',')
  50.                                     ->info('delimits csv values')
  51.                                 ->end()
  52.                                 ->scalarNode('enclosure')
  53.                                     ->defaultValue('"')
  54.                                     ->info('will be used when a value contains the delimiter')
  55.                                 ->end()
  56.                                 ->scalarNode('escape')
  57.                                     ->defaultValue('\\')
  58.                                     ->info('will be used when a value contains the enclosure')
  59.                                 ->end()
  60.                                 ->booleanNode('show_headers')
  61.                                     ->defaultValue(true)
  62.                                     ->info('add column names as the first line')
  63.                                 ->end()
  64.                                 ->booleanNode('with_bom')
  65.                                     ->defaultValue(false)
  66.                                     ->info('include the byte order mark')
  67.                                 ->end()
  68.                             ->end()
  69.                         ->end()
  70.                         ->arrayNode('json')
  71.                             ->addDefaultsIfNotSet()
  72.                             ->children()
  73.                                 ->scalarNode('filename')
  74.                                     ->defaultValue('php://output')
  75.                                     ->info('path to the output file')
  76.                                 ->end()
  77.                             ->end()
  78.                         ->end()
  79.                         ->arrayNode('xls')
  80.                             ->addDefaultsIfNotSet()
  81.                             ->children()
  82.                                 ->scalarNode('filename')
  83.                                     ->defaultValue('php://output')
  84.                                     ->info('path to the output file')
  85.                                 ->end()
  86.                                 ->booleanNode('show_headers')
  87.                                     ->defaultValue(true)
  88.                                     ->info('add column names as the first line')
  89.                                 ->end()
  90.                             ->end()
  91.                         ->end()
  92.                         ->arrayNode('xml')
  93.                             ->addDefaultsIfNotSet()
  94.                             ->children()
  95.                                 ->scalarNode('filename')
  96.                                     ->defaultValue('php://output')
  97.                                     ->info('path to the output file')
  98.                                 ->end()
  99.                                 ->booleanNode('show_headers')
  100.                                     ->defaultValue(true)
  101.                                     ->info('add column names as the first line')
  102.                                 ->end()
  103.                                 ->scalarNode('main_element')
  104.                                     ->defaultValue('datas')
  105.                                     ->info('name of the wrapping element')
  106.                                 ->end()
  107.                                 ->scalarNode('child_element')
  108.                                     ->defaultValue('data')
  109.                                     ->info('name of elements corresponding to rows')
  110.                                 ->end()
  111.                             ->end()
  112.                         ->end()
  113.                     ->end()
  114.                 ->end()
  115.             ->end()
  116.         ;
  117.         return $treeBuilder;
  118.     }
  119. }
  120. class_exists(\Exporter\Bridge\Symfony\DependencyInjection\Configuration::class);