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\SyliusCmsPlugin\Fixture; |
12
|
|
|
|
13
|
|
|
use BitBag\SyliusCmsPlugin\Fixture\Factory\FixtureFactoryInterface; |
14
|
|
|
use Sylius\Bundle\FixturesBundle\Fixture\AbstractFixture; |
15
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
16
|
|
|
|
17
|
|
|
final class PageFixture extends AbstractFixture |
18
|
|
|
{ |
19
|
|
|
/** @var FixtureFactoryInterface */ |
20
|
|
|
private $pageFixtureFactory; |
21
|
|
|
|
22
|
|
|
public function __construct(FixtureFactoryInterface $pageFixtureFactory) |
23
|
|
|
{ |
24
|
|
|
$this->pageFixtureFactory = $pageFixtureFactory; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function load(array $options): void |
28
|
|
|
{ |
29
|
|
|
$this->pageFixtureFactory->load($options['custom']); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function getName(): string |
33
|
|
|
{ |
34
|
|
|
return 'page'; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void |
38
|
|
|
{ |
39
|
|
|
$optionsNode |
40
|
|
|
->children() |
41
|
|
|
->arrayNode('custom') |
42
|
|
|
->arrayPrototype() |
43
|
|
|
->children() |
44
|
|
|
->booleanNode('remove_existing')->defaultTrue()->end() |
45
|
|
|
->integerNode('number')->defaultNull()->end() |
|
|
|
|
46
|
|
|
->booleanNode('enabled')->defaultTrue()->end() |
47
|
|
|
->integerNode('products')->defaultNull()->end() |
48
|
|
|
->arrayNode('productCodes')->scalarPrototype()->end()->end() |
49
|
|
|
->arrayNode('sections')->scalarPrototype()->end()->end() |
50
|
|
|
->arrayNode('channels')->scalarPrototype()->end()->end() |
51
|
|
|
->arrayNode('translations') |
52
|
|
|
->prototype('array') |
53
|
|
|
->children() |
54
|
|
|
->scalarNode('slug')->defaultNull()->end() |
55
|
|
|
->scalarNode('name')->defaultNull()->end() |
56
|
|
|
->scalarNode('name_when_linked')->defaultNull()->end() |
57
|
|
|
->scalarNode('description_when_linked')->defaultNull()->end() |
58
|
|
|
->scalarNode('image_path')->defaultNull()->end() |
59
|
|
|
->scalarNode('meta_keywords')->defaultNull()->end() |
60
|
|
|
->scalarNode('meta_description')->defaultNull()->end() |
61
|
|
|
->scalarNode('content')->defaultNull()->end() |
62
|
|
|
->end() |
63
|
|
|
->end() |
64
|
|
|
->end() |
65
|
|
|
->end() |
66
|
|
|
->end() |
67
|
|
|
->end() |
68
|
|
|
->end() |
69
|
|
|
; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|