|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the ONGR package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) NFQ Technologies UAB <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace ONGR\CurrencyExchangeBundle\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
|
|
|
class Configuration implements ConfigurationInterface |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* {@inheritdoc} |
|
24
|
|
|
*/ |
|
25
|
6 |
|
public function getConfigTreeBuilder() |
|
26
|
|
|
{ |
|
27
|
6 |
|
$treeBuilder = new TreeBuilder(); |
|
28
|
6 |
|
$rootNode = $treeBuilder->root('ongr_currency_exchange'); |
|
29
|
|
|
|
|
30
|
|
|
$rootNode |
|
31
|
6 |
|
->children() |
|
32
|
6 |
|
->scalarNode('es_manager') |
|
33
|
6 |
|
->defaultValue('default') |
|
34
|
6 |
|
->info('Elasticsearch manager to use in router') |
|
35
|
6 |
|
->example('product') |
|
36
|
6 |
|
->end() |
|
37
|
6 |
|
->scalarNode('default_currency') |
|
38
|
6 |
|
->defaultValue('EUR') |
|
39
|
6 |
|
->info('set default currency') |
|
40
|
6 |
|
->end() |
|
41
|
6 |
|
->arrayNode('currencies') |
|
42
|
6 |
|
->useAttributeAsKey('name') |
|
43
|
6 |
|
->prototype('scalar') |
|
44
|
6 |
|
->end() |
|
45
|
6 |
|
->end() |
|
46
|
6 |
|
->arrayNode('separators') |
|
47
|
6 |
|
->addDefaultsIfNotSet() |
|
48
|
6 |
|
->children() |
|
49
|
6 |
|
->scalarNode('decimal') |
|
50
|
6 |
|
->defaultValue(',') |
|
51
|
6 |
|
->end() |
|
52
|
6 |
|
->scalarNode('thousands') |
|
53
|
6 |
|
->defaultValue('.') |
|
54
|
6 |
|
->end() |
|
55
|
6 |
|
->end() |
|
56
|
6 |
|
->end() |
|
57
|
6 |
|
->scalarNode('currency_sign') |
|
58
|
6 |
|
->defaultValue('€') |
|
59
|
6 |
|
->end() |
|
60
|
6 |
|
->arrayNode('templates') |
|
61
|
6 |
|
->addDefaultsIfNotSet() |
|
62
|
6 |
|
->children() |
|
63
|
6 |
|
->scalarNode('currency_list') |
|
64
|
6 |
|
->defaultValue('ONGRCurrencyExchangeBundle::currency_list.html.twig') |
|
65
|
6 |
|
->end() |
|
66
|
6 |
|
->scalarNode('price_list') |
|
67
|
6 |
|
->defaultValue('ONGRCurrencyExchangeBundle::price_list.html.twig') |
|
68
|
6 |
|
->end() |
|
69
|
6 |
|
->end() |
|
70
|
6 |
|
->end() |
|
71
|
6 |
|
->scalarNode('driver') |
|
72
|
6 |
|
->defaultValue('ongr_currency_exchange.ecb_driver') |
|
73
|
6 |
|
->info('Currency driver service to use in currency rate service') |
|
74
|
6 |
|
->end() |
|
75
|
6 |
|
->scalarNode('open_exchange_rates_api_id') |
|
76
|
6 |
|
->defaultNull() |
|
77
|
|
|
->info('Open Exchange Rates API ID') |
|
78
|
6 |
|
->end() |
|
79
|
|
|
->end(); |
|
80
|
|
|
|
|
81
|
|
|
return $treeBuilder; |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|