1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Sylius package. |
5
|
|
|
* |
6
|
|
|
* (c) Paweł Jędrzejewski |
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 Sylius\Bundle\CoreBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Sylius\Bundle\CoreBundle\Controller\ProductTaxonController; |
15
|
|
|
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle; |
16
|
|
|
use Sylius\Component\Core\Model\ProductImage; |
17
|
|
|
use Sylius\Component\Core\Model\ProductImageInterface; |
18
|
|
|
use Sylius\Component\Core\Model\ProductTaxon; |
19
|
|
|
use Sylius\Component\Core\Model\ProductTaxonInterface; |
20
|
|
|
use Sylius\Component\Core\Model\TaxonImage; |
21
|
|
|
use Sylius\Component\Core\Model\TaxonImageInterface; |
22
|
|
|
use Sylius\Component\Resource\Factory\Factory; |
23
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
24
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
25
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
26
|
|
|
|
27
|
|
|
final class Configuration implements ConfigurationInterface |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* @return TreeBuilder |
31
|
|
|
*/ |
32
|
|
|
public function getConfigTreeBuilder() |
33
|
|
|
{ |
34
|
|
|
$treeBuilder = new TreeBuilder(); |
35
|
|
|
$rootNode = $treeBuilder->root('sylius_core'); |
36
|
|
|
|
37
|
|
|
$rootNode |
38
|
|
|
->addDefaultsIfNotSet() |
39
|
|
|
->children() |
40
|
|
|
->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end() |
41
|
|
|
->end() |
42
|
|
|
; |
43
|
|
|
|
44
|
|
|
$this->addResourcesSection($rootNode); |
45
|
|
|
|
46
|
|
|
return $treeBuilder; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param ArrayNodeDefinition $node |
51
|
|
|
*/ |
52
|
|
|
private function addResourcesSection(ArrayNodeDefinition $node) |
53
|
|
|
{ |
54
|
|
|
$node |
55
|
|
|
->children() |
56
|
|
|
->arrayNode('resources') |
57
|
|
|
->addDefaultsIfNotSet() |
58
|
|
|
->children() |
59
|
|
|
->arrayNode('product_image') |
60
|
|
|
->addDefaultsIfNotSet() |
61
|
|
|
->children() |
62
|
|
|
->variableNode('options')->end() |
63
|
|
|
->arrayNode('classes') |
64
|
|
|
->addDefaultsIfNotSet() |
65
|
|
|
->children() |
66
|
|
|
->scalarNode('model')->defaultValue(ProductImage::class)->cannotBeEmpty()->end() |
67
|
|
|
->scalarNode('interface')->defaultValue(ProductImageInterface::class)->cannotBeEmpty()->end() |
68
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->end() |
69
|
|
|
->end() |
70
|
|
|
->end() |
71
|
|
|
->end() |
72
|
|
|
->end() |
73
|
|
|
->arrayNode('taxon_image') |
74
|
|
|
->addDefaultsIfNotSet() |
75
|
|
|
->children() |
76
|
|
|
->variableNode('options')->end() |
77
|
|
|
->arrayNode('classes') |
78
|
|
|
->addDefaultsIfNotSet() |
79
|
|
|
->children() |
80
|
|
|
->scalarNode('model')->defaultValue(TaxonImage::class)->cannotBeEmpty()->end() |
81
|
|
|
->scalarNode('interface')->defaultValue(TaxonImageInterface::class)->cannotBeEmpty()->end() |
82
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->end() |
83
|
|
|
->end() |
84
|
|
|
->end() |
85
|
|
|
->end() |
86
|
|
|
->end() |
87
|
|
|
->arrayNode('product_taxon') |
88
|
|
|
->addDefaultsIfNotSet() |
89
|
|
|
->children() |
90
|
|
|
->variableNode('options')->end() |
91
|
|
|
->arrayNode('classes') |
92
|
|
|
->addDefaultsIfNotSet() |
93
|
|
|
->children() |
94
|
|
|
->scalarNode('model')->defaultValue(ProductTaxon::class)->cannotBeEmpty()->end() |
95
|
|
|
->scalarNode('interface')->defaultValue(ProductTaxonInterface::class)->cannotBeEmpty()->end() |
96
|
|
|
->scalarNode('controller')->defaultValue(ProductTaxonController::class)->cannotBeEmpty()->end() |
97
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->end() |
98
|
|
|
->end() |
99
|
|
|
->end() |
100
|
|
|
->end() |
101
|
|
|
->end() |
102
|
|
|
->end() |
103
|
|
|
->end() |
104
|
|
|
->end() |
105
|
|
|
; |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|