1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file has been created by 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\SyliusCmsPlugin\Fixture; |
14
|
|
|
|
15
|
|
|
use BitBag\SyliusCmsPlugin\Fixture\Factory\FixtureFactoryInterface; |
16
|
|
|
use Sylius\Bundle\FixturesBundle\Fixture\AbstractFixture; |
17
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
18
|
|
|
|
19
|
|
|
final class MediaFixture extends AbstractFixture |
20
|
|
|
{ |
21
|
|
|
/** @var FixtureFactoryInterface */ |
22
|
|
|
private $mediaFixtureFactory; |
23
|
|
|
|
24
|
|
|
public function __construct(FixtureFactoryInterface $mediaFixtureFactory) |
25
|
|
|
{ |
26
|
|
|
$this->mediaFixtureFactory = $mediaFixtureFactory; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function load(array $options): void |
30
|
|
|
{ |
31
|
|
|
$this->mediaFixtureFactory->load($options['custom']); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function getName(): string |
35
|
|
|
{ |
36
|
|
|
return 'media'; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void |
40
|
|
|
{ |
41
|
|
|
$optionsNode |
42
|
|
|
->children() |
43
|
|
|
->arrayNode('custom') |
44
|
|
|
->prototype('array') |
45
|
|
|
->children() |
46
|
|
|
->booleanNode('remove_existing')->defaultTrue()->end() |
47
|
|
|
->integerNode('number')->defaultNull()->end() |
48
|
|
|
->booleanNode('code')->isRequired()->cannotBeEmpty()->end() |
49
|
|
|
->scalarNode('type')->isRequired()->cannotBeEmpty()->end() |
50
|
|
|
->scalarNode('path')->isRequired()->cannotBeEmpty()->end() |
51
|
|
|
->booleanNode('enabled')->defaultTrue()->end() |
52
|
|
|
->arrayNode('sections') |
53
|
|
|
->prototype('scalar')->end() |
54
|
|
|
->end() |
55
|
|
|
->arrayNode('products') |
56
|
|
|
->prototype('scalar')->end() |
57
|
|
|
->end() |
58
|
|
|
->arrayNode('translations') |
59
|
|
|
->prototype('array') |
60
|
|
|
->children() |
61
|
|
|
->scalarNode('name')->defaultNull()->end() |
62
|
|
|
->scalarNode('description')->defaultNull()->end() |
63
|
|
|
->scalarNode('alt')->defaultNull()->end() |
64
|
|
|
->end() |
65
|
|
|
->end() |
66
|
|
|
->end() |
67
|
|
|
->end() |
68
|
|
|
->end() |
69
|
|
|
->end() |
70
|
|
|
->end() |
71
|
|
|
; |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|