for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of HeriJobQueueBundle.
*
* (c) Alexandre Mogère
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Heri\Bundle\JobQueueBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files.
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
class Configuration implements ConfigurationInterface
{
* {@inheritdoc}
public function getConfigTreeBuilder()
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('heri_job_queue');
$rootNode
->addDefaultsIfNotSet()
->children()
->scalarNode('adapter')
->defaultValue('doctrine')
->validate()
->ifNotInArray(['doctrine', 'amqp'])
->thenInvalid('Invalid adapter "%s"')
->end()
->booleanNode('enabled')
->defaultTrue()
->integerNode('max_messages')
->defaultValue(1)
->min(1)
->integerNode('process_timeout')
->defaultNull()
->arrayNode('queues')
->prototype('scalar')
->arrayNode('amqp_connection')
->scalarNode('host')->defaultValue('localhost')->end()
->scalarNode('port')->defaultValue('5672')->end()
->scalarNode('user')->defaultValue('guest')->end()
->scalarNode('password')->defaultValue('guest')->end()
;
return $treeBuilder;
}