1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file was created by developers working at BitBag |
5
|
|
|
* Do you need more information about us and what we do? Visit our https://bitbag.io website! |
6
|
|
|
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
declare(strict_types=1); |
10
|
|
|
|
11
|
|
|
namespace BitBag\SyliusWishlistPlugin\DependencyInjection; |
12
|
|
|
|
13
|
|
|
use BitBag\SyliusWishlistPlugin\Entity\Wishlist; |
14
|
|
|
use BitBag\SyliusWishlistPlugin\Entity\WishlistInterface; |
15
|
|
|
use BitBag\SyliusWishlistPlugin\Entity\WishlistProduct; |
16
|
|
|
use BitBag\SyliusWishlistPlugin\Entity\WishlistProductInterface; |
17
|
|
|
use BitBag\SyliusWishlistPlugin\Repository\WishlistRepository; |
18
|
|
|
use Sylius\Bundle\ResourceBundle\Controller\ResourceController; |
19
|
|
|
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; |
20
|
|
|
use Sylius\Component\Resource\Factory\Factory; |
21
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
22
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
23
|
|
|
|
24
|
|
|
final class Configuration implements ConfigurationInterface |
25
|
|
|
{ |
26
|
|
|
public function getConfigTreeBuilder(): TreeBuilder |
27
|
|
|
{ |
28
|
|
|
$treeBuilder = new TreeBuilder('bitbag_sylius_wishlist_plugin'); |
29
|
|
|
$rootNode = $treeBuilder->getRootNode(); |
30
|
|
|
/** @phpstan-ignore-next-line */ |
31
|
|
|
$rootNode |
32
|
|
|
->children() |
33
|
|
|
->scalarNode('wishlist_cookie_token') |
34
|
|
|
->defaultValue('wishlist_cookie_token') |
35
|
|
|
->cannotBeEmpty() |
36
|
|
|
->end() |
37
|
|
|
->arrayNode('allowed_mime_types') |
38
|
|
|
->defaultValue([ |
39
|
|
|
'text/csv', |
40
|
|
|
'text/plain', |
41
|
|
|
'application/csv', |
42
|
|
|
'text/comma-separated-values', |
43
|
|
|
'application/excel', |
44
|
|
|
'application/vnd.ms-excel', |
45
|
|
|
'application/vnd.msexcel', |
46
|
|
|
'text/anytext', |
47
|
|
|
'application/octet-stream', |
48
|
|
|
'application/txt', |
49
|
|
|
]) |
50
|
|
|
->requiresAtLeastOneElement() |
51
|
|
|
->scalarPrototype()->end() |
52
|
|
|
->end() |
53
|
|
|
->arrayNode('resources') |
54
|
|
|
->addDefaultsIfNotSet() |
55
|
|
|
->children() |
56
|
|
|
->arrayNode('wishlist') |
57
|
|
|
->addDefaultsIfNotSet() |
58
|
|
|
->children() |
59
|
|
|
->variableNode('options')->end() |
60
|
|
|
->arrayNode('classes') |
61
|
|
|
->addDefaultsIfNotSet() |
62
|
|
|
->children() |
63
|
|
|
->scalarNode('model')->defaultValue(Wishlist::class)->cannotBeEmpty()->end() |
64
|
|
|
->scalarNode('interface')->defaultValue(WishlistInterface::class)->cannotBeEmpty()->end() |
65
|
|
|
->scalarNode('repository')->defaultValue(WishlistRepository::class)->cannotBeEmpty()->end() |
66
|
|
|
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
67
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() |
68
|
|
|
->end() |
69
|
|
|
->end() |
70
|
|
|
->end() |
71
|
|
|
->end() |
72
|
|
|
->arrayNode('wishlist_product') |
73
|
|
|
->addDefaultsIfNotSet() |
74
|
|
|
->children() |
75
|
|
|
->variableNode('options')->end() |
76
|
|
|
->arrayNode('classes') |
77
|
|
|
->addDefaultsIfNotSet() |
78
|
|
|
->children() |
79
|
|
|
->scalarNode('model')->defaultValue(WishlistProduct::class)->cannotBeEmpty()->end() |
80
|
|
|
->scalarNode('interface')->defaultValue(WishlistProductInterface::class)->cannotBeEmpty()->end() |
81
|
|
|
->scalarNode('repository')->defaultValue(EntityRepository::class)->cannotBeEmpty()->end() |
82
|
|
|
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
83
|
|
|
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() |
84
|
|
|
->end() |
85
|
|
|
->end() |
86
|
|
|
->end() |
87
|
|
|
->end() |
88
|
|
|
->end() |
89
|
|
|
->end() |
90
|
|
|
->end() |
91
|
|
|
; |
92
|
|
|
|
93
|
|
|
return $treeBuilder; |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|