public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('abc_job');

        $supportedDrivers = ['orm', 'custom'];
        $supportedAdapters = ['bernard', 'sonata', 'custom'];
        $supportedLogStorages = ['file', 'orm', 'custom'];
        $supportedLogLevels = ['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert'];

        $rootNode
            ->children()
                ->scalarNode('db_driver')
                    ->defaultValue('orm')
                    ->validate()
                        ->ifNotInArray($supportedDrivers)
                        ->thenInvalid('The driver %s is not supported. Please choose one of ' . json_encode($supportedDrivers))
                    ->end()
                ->end()
                ->scalarNode('adapter')
                    ->validate()
                        ->ifNotInArray($supportedAdapters)
                        ->thenInvalid('The adapter %s is not supported. Please choose one of ' . json_encode($supportedAdapters))
                    ->end()
                    ->isRequired()
                ->end()
                ->arrayNode('manager')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('validate')->defaultTrue()->end()
                    ->end()
                ->end()
                ->scalarNode('default_queue')->defaultValue('default')->end()
                ->arrayNode('queues')
                    ->useAttributeAsKey('name')
                    ->prototype('array')
                        ->prototype('scalar')->end()
                    ->end()
                ->end()
                ->booleanNode('register_default_jobs')
                    ->defaultFalse()
                ->end()
                ->scalarNode('connection')
                    ->defaultValue('default')
                ->end()
                ->scalarNode('model_manager_name')
                    ->defaultNull()
                ->end()
                ->arrayNode('controller')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('refresh_interval')->defaultValue(1)->end()
                    ->end()
                ->end()
                ->arrayNode('rest')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('enable')->defaultTrue()->end()
                        ->scalarNode('validate')->defaultFalse()->end()
                    ->end()
                ->end()
                ->arrayNode('logging')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('storage_handler')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->scalarNode('type')
                                ->defaultValue('file')
                                ->validate()
                                    ->ifNotInArray($supportedLogStorages)
                                    ->thenInvalid('The storage type %s is not supported. Please choose one of ' . json_encode($supportedLogStorages))
                                ->end()
                                ->cannotBeEmpty()
                                ->end()
                                ->scalarNode('path')->defaultValue('%kernel.logs_dir%')->end()
                                ->scalarNode('level')
                                    ->defaultValue('info')
                                    ->validate()
                                        ->ifNotInArray($supportedLogLevels)
                                        ->thenInvalid('The level %s is not supported. Please choose one of ' . json_encode($supportedLogLevels))
                                    ->end()
                                ->end()
                                ->booleanNode('bubble')->defaultValue(true)->end()
                                ->arrayNode('processor')
                                    ->canBeUnset()
                                    ->useAttributeAsKey('name')
                                    ->prototype('scalar')->end()
                                ->end()
                            ->end()
                        ->end()

                        ->arrayNode('stream_handler')
                            ->canBeUnset()
                            ->children()
                                ->scalarNode('path')->defaultValue('%kernel.logs_dir%')->end()
                                ->scalarNode('level')
                                    ->defaultValue('info')
                                    ->validate()
                                        ->ifNotInArray($supportedLogLevels)
                                        ->thenInvalid('The level %s is not supported. Please choose one of ' . json_encode($supportedLogLevels))
                                    ->end()
                                ->end()
                                ->booleanNode('bubble')->defaultTrue()->end()
                                ->scalarNode('formatter')->defaultNull()->end()
                                ->arrayNode('processor')
                                    ->canBeUnset()
                                    ->useAttributeAsKey('name')
                                    ->prototype('scalar')->end()
                                ->end()
                            ->end()
                        ->end()
                        ->arrayNode('handler')
                            ->canBeUnset()
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                        ->end()
                        ->arrayNode('level')
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                ->end()
            ->end();

        $this->addServiceSection($rootNode);

        return $treeBuilder;
    }
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('abc_job');

        $supportedDrivers = ['orm', 'custom'];
        $supportedAdapters = ['bernard', 'sonata', 'custom'];
        $supportedLogStorages = ['file', 'orm', 'custom'];
        $supportedLogLevels = ['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert'];

        $rootNode
            ->children()
                ->scalarNode('db_driver')
                    ->defaultValue('orm')
                    ->validate()
                        ->ifNotInArray($supportedDrivers)
                        ->thenInvalid('The driver %s is not supported. Please choose one of ' . json_encode($supportedDrivers))
                    ->end()
                ->end()
                ->scalarNode('adapter')
                    ->validate()
                        ->ifNotInArray($supportedAdapters)
                        ->thenInvalid('The adapter %s is not supported. Please choose one of ' . json_encode($supportedAdapters))
                    ->end()
                    ->isRequired()
                ->end()
                ->arrayNode('manager')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('validate')->defaultTrue()->end()
                    ->end()
                ->end()
                ->scalarNode('default_queue')->defaultValue('default')->end()
                ->arrayNode('queues')
                    ->useAttributeAsKey('name')
                    ->prototype('array')
                        ->prototype('scalar')->end()
                    ->end()
                ->end()
                ->booleanNode('register_default_jobs')
                    ->defaultFalse()
                ->end()
                ->scalarNode('connection')
                    ->defaultValue('default')
                ->end()
                ->scalarNode('model_manager_name')
                    ->defaultNull()
                ->end()
                ->arrayNode('controller')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('refresh_interval')->defaultValue(1)->end()
                    ->end()
                ->end()
                ->arrayNode('rest')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('enable')->defaultTrue()->end()
                        ->scalarNode('validate')->defaultFalse()->end()
                    ->end()
                ->end()
                ->arrayNode('logging')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('storage_handler')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->scalarNode('type')
                                ->defaultValue('file')
                                ->validate()
                                    ->ifNotInArray($supportedLogStorages)
                                    ->thenInvalid('The storage type %s is not supported. Please choose one of ' . json_encode($supportedLogStorages))
                                ->end()
                                ->cannotBeEmpty()
                                ->end()
                                ->scalarNode('path')->defaultValue('%kernel.logs_dir%')->end()
                                ->scalarNode('level')
                                    ->defaultValue('info')
                                    ->validate()
                                        ->ifNotInArray($supportedLogLevels)
                                        ->thenInvalid('The level %s is not supported. Please choose one of ' . json_encode($supportedLogLevels))
                                    ->end()
                                ->end()
                                ->booleanNode('bubble')->defaultValue(true)->end()
                                ->arrayNode('processor')
                                    ->canBeUnset()
                                    ->useAttributeAsKey('name')
                                    ->prototype('scalar')->end()
                                ->end()
                            ->end()
                        ->end()

                        ->arrayNode('stream_handler')
                            ->canBeUnset()
                            ->children()
                                ->scalarNode('path')->defaultValue('%kernel.logs_dir%')->end()
                                ->scalarNode('level')
                                    ->defaultValue('info')
                                    ->validate()
                                        ->ifNotInArray($supportedLogLevels)
                                        ->thenInvalid('The level %s is not supported. Please choose one of ' . json_encode($supportedLogLevels))
                                    ->end()
                                ->end()
                                ->booleanNode('bubble')->defaultTrue()->end()
                                ->scalarNode('formatter')->defaultNull()->end()
                                ->arrayNode('processor')
                                    ->canBeUnset()
                                    ->useAttributeAsKey('name')
                                    ->prototype('scalar')->end()
                                ->end()
                            ->end()
                        ->end()
                        ->arrayNode('handler')
                            ->canBeUnset()
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                        ->end()
                        ->arrayNode('level')
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                ->end()
            ->end();

        $this->addServiceSection($rootNode);

        return $treeBuilder;
    }
{@inheritDoc}