1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace BitBag\SyliusWishlistPlugin\DependencyInjection; |
6
|
|
|
|
7
|
|
|
use BitBag\SyliusWishlistPlugin\Entity\Wishlist; |
8
|
|
|
use BitBag\SyliusWishlistPlugin\Entity\WishlistInterface; |
9
|
|
|
use BitBag\SyliusWishlistPlugin\Entity\WishlistProduct; |
10
|
|
|
use BitBag\SyliusWishlistPlugin\Entity\WishlistProductInterface; |
11
|
|
|
use BitBag\SyliusWishlistPlugin\Repository\WishlistRepository; |
12
|
|
|
use Sylius\Bundle\ResourceBundle\Controller\ResourceController; |
13
|
|
|
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; |
14
|
|
|
use Sylius\Component\Resource\Factory\Factory; |
15
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
16
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
17
|
|
|
|
18
|
|
|
final class Configuration implements ConfigurationInterface |
19
|
|
|
{ |
20
|
|
|
public function getConfigTreeBuilder(): TreeBuilder |
21
|
|
|
{ |
22
|
|
|
$treeBuilder = new TreeBuilder('bitbag_sylius_wishlist_plugin'); |
23
|
|
|
$rootNode = $treeBuilder->getRootNode(); |
24
|
|
|
$rootNode |
25
|
|
|
->children() |
26
|
|
|
->arrayNode('resources') |
27
|
|
|
->addDefaultsIfNotSet() |
28
|
|
|
->children() |
29
|
|
|
->arrayNode('wishlist') |
30
|
|
|
->addDefaultsIfNotSet() |
31
|
|
|
->children() |
32
|
|
|
->variableNode('options')->end() |
33
|
|
|
->arrayNode('classes') |
34
|
|
|
->addDefaultsIfNotSet() |
35
|
|
|
->children() |
36
|
|
|
->scalarNode('model')->defaultValue(Wishlist::class)->cannotBeEmpty()->end() |
37
|
|
|
->scalarNode('interface')->defaultValue(WishlistInterface::class)->cannotBeEmpty()->end() |
38
|
|
|
->scalarNode('repository')->defaultValue(WishlistRepository::class)->cannotBeEmpty()->end() |
39
|
|
|
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
40
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() |
41
|
|
|
->end() |
42
|
|
|
->end() |
43
|
|
|
->end() |
44
|
|
|
->end() |
45
|
|
|
->arrayNode('wishlist_product') |
46
|
|
|
->addDefaultsIfNotSet() |
47
|
|
|
->children() |
48
|
|
|
->variableNode('options')->end() |
49
|
|
|
->arrayNode('classes') |
50
|
|
|
->addDefaultsIfNotSet() |
51
|
|
|
->children() |
52
|
|
|
->scalarNode('model')->defaultValue(WishlistProduct::class)->cannotBeEmpty()->end() |
53
|
|
|
->scalarNode('interface')->defaultValue(WishlistProductInterface::class)->cannotBeEmpty()->end() |
54
|
|
|
->scalarNode('repository')->defaultValue(WishlistRepository::class)->cannotBeEmpty()->end() |
55
|
|
|
->scalarNode('controller')->defaultValue(EntityRepository::class)->cannotBeEmpty()->end() |
56
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() |
57
|
|
|
->end() |
58
|
|
|
->end() |
59
|
|
|
->end() |
60
|
|
|
->end() |
61
|
|
|
->end() |
62
|
|
|
->end() |
63
|
|
|
->end() |
64
|
|
|
; |
65
|
|
|
|
66
|
|
|
return $treeBuilder; |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|