for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Zenstruck\ElasticaBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* @author Kevin Bond <[email protected]>
*/
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('zenstruck_elastica');
$rootNode
->children()
->booleanNode('logging')->defaultFalse()->end()
->variableNode('client')
->isRequired()
->validate()
->ifTrue(function ($value) { return !is_array($value); })
->thenInvalid('Client config must be an array.')
->end()
->arrayNode('index')
->scalarNode('name')->isRequired()->end()
->variableNode('settings')
->defaultNull()
->thenInvalid('Index settings must be an array.')
->arrayNode('types')
->useAttributeAsKey('alias')
->prototype('array')
->scalarNode('service')->isRequired()->end()
->variableNode('mapping')
->info('Can be an array of mappings or a service that implements Zenstruck\ElasticaBundle\Elastica\MappingProvider or Elastica\Type\Mapping')
;
return $treeBuilder;
}