|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file was created by the developers from BitBag. |
|
5
|
|
|
* Feel free to contact us once you face any issues or want to start |
|
6
|
|
|
* another great project. |
|
7
|
|
|
* You can find more information about us on https://bitbag.shop and write us |
|
8
|
|
|
* an email on [email protected]. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
declare(strict_types=1); |
|
12
|
|
|
|
|
13
|
|
|
namespace BitBag\CmsPlugin\Fixture; |
|
14
|
|
|
|
|
15
|
|
|
use BitBag\CmsPlugin\Fixture\Factory\FixtureFactoryInterface; |
|
16
|
|
|
use Sylius\Bundle\FixturesBundle\Fixture\AbstractFixture; |
|
17
|
|
|
use Sylius\Bundle\FixturesBundle\Fixture\FixtureInterface; |
|
18
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @author Mikołaj Król <[email protected]> |
|
22
|
|
|
*/ |
|
23
|
|
|
final class PageFixture extends AbstractFixture implements FixtureInterface |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* @var FixtureFactoryInterface |
|
27
|
|
|
*/ |
|
28
|
|
|
private $pageFixtureFactory; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @param FixtureFactoryInterface $pageFixtureFactory |
|
32
|
|
|
*/ |
|
33
|
|
|
public function __construct(FixtureFactoryInterface $pageFixtureFactory) |
|
34
|
|
|
{ |
|
35
|
|
|
$this->pageFixtureFactory = $pageFixtureFactory; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* {@inheritDoc} |
|
40
|
|
|
*/ |
|
41
|
|
|
public function load(array $options): void |
|
42
|
|
|
{ |
|
43
|
|
|
$this->pageFixtureFactory->load($options['custom']); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* {@inheritDoc} |
|
48
|
|
|
*/ |
|
49
|
|
|
public function getName(): string |
|
50
|
|
|
{ |
|
51
|
|
|
return 'page'; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* {@inheritDoc} |
|
56
|
|
|
*/ |
|
57
|
|
|
protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void |
|
58
|
|
|
{ |
|
59
|
|
|
$optionsNode |
|
60
|
|
|
->children() |
|
61
|
|
|
->arrayNode('custom') |
|
62
|
|
|
->prototype('array') |
|
63
|
|
|
->children() |
|
64
|
|
|
->booleanNode('remove_existing')->defaultTrue()->end() |
|
65
|
|
|
->integerNode('number')->defaultNull()->end() |
|
66
|
|
|
->booleanNode('enabled')->defaultTrue()->end() |
|
67
|
|
|
->integerNode('products')->defaultNull()->end() |
|
68
|
|
|
->arrayNode('sections') |
|
69
|
|
|
->prototype('scalar')->end() |
|
70
|
|
|
->end() |
|
71
|
|
|
->arrayNode('translations') |
|
72
|
|
|
->prototype('array') |
|
73
|
|
|
->children() |
|
74
|
|
|
->scalarNode('slug')->defaultNull()->end() |
|
75
|
|
|
->scalarNode('name')->defaultNull()->end() |
|
76
|
|
|
->scalarNode('meta_keywords')->defaultNull()->end() |
|
77
|
|
|
->scalarNode('meta_description')->defaultNull()->end() |
|
78
|
|
|
->scalarNode('content')->defaultNull()->end() |
|
79
|
|
|
->end() |
|
80
|
|
|
->end() |
|
81
|
|
|
->end() |
|
82
|
|
|
->end() |
|
83
|
|
|
->end() |
|
84
|
|
|
->end() |
|
85
|
|
|
->end() |
|
86
|
|
|
; |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|