Completed
Push — master ( 85fe60...faaee8 )
by Florian
02:37
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 47
Code Lines 43

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 47
rs 9.0303
c 0
b 0
f 0
cc 1
eloc 43
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Stinger Entity Search package.
5
 *
6
 * (c) Oliver Kotte <[email protected]>
7
 * (c) Florian Meyer <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
namespace StingerSoft\EntitySearchBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * This is the class that validates and merges configuration from your app/config files
19
 *
20
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
21
 */
22
class Configuration implements ConfigurationInterface {
23
24
	/**
25
	 *
26
	 * {@inheritDoc}
27
	 *
28
	 */
29
	public function getConfigTreeBuilder() {
30
		$treeBuilder = new TreeBuilder();
31
		$root = $treeBuilder->root('stinger_soft_entity_search');
32
		// @formatter:off
33
		$root->children()
34
			->booleanNode('enable_indexing')->defaultFalse()->end()
35
			->booleanNode('enable_search')->defaultFalse()->end()
36
			->scalarNode('search_service')->defaultValue('stinger_soft.entity_search.dummy_search_service')->end()
37
			->arrayNode('results')->addDefaultsIfNotSet()
38
				->children()
39
					->integerNode('max_choice_group_count')->defaultValue(10)->end()
40
					->arrayNode('preferred_type_choices')
41
						->prototype('scalar')->end()
42
					->end()
43
					->arrayNode('preferred_filetype_choices')
44
						->prototype('scalar')->end()
45
					->end()
46
					->arrayNode('ingore_patterns')
47
						->prototype('scalar')->end()
48
					->end()
49
				->end()
50
			->end()
51
			->arrayNode('types')
52
			->useAttributeAsKey('name')
53
			->prototype('array')
54
				->children()
55
					->arrayNode('mappings')
56
						->useAttributeAsKey('name')
57
						->cannotBeEmpty()
58
						->prototype('array')
59
							->children()
60
								->scalarNode('propertyPath')->defaultValue(false)->end()
61
							->end()
62
						->end()
63
					->end()
64
					->arrayNode('persistence')
65
						->children()
66
							->scalarNode('model')->end()
67
						->end()
68
					->end()
69
				->end()
70
			->end()
71
		->end();
72
		// @formatter:on
73
		
74
		return $treeBuilder;
75
	}
76
}
77