BitBagCommerce /
SyliusCmsPlugin
| 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 MediaFixture extends AbstractFixture |
||
| 18 | { |
||
| 19 | /** @var FixtureFactoryInterface */ |
||
| 20 | private $mediaFixtureFactory; |
||
| 21 | |||
| 22 | public function __construct(FixtureFactoryInterface $mediaFixtureFactory) |
||
| 23 | { |
||
| 24 | $this->mediaFixtureFactory = $mediaFixtureFactory; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function load(array $options): void |
||
| 28 | { |
||
| 29 | $this->mediaFixtureFactory->load($options['custom']); |
||
| 30 | } |
||
| 31 | |||
| 32 | public function getName(): string |
||
| 33 | { |
||
| 34 | return 'media'; |
||
| 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() |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 46 | ->scalarNode('type')->isRequired()->cannotBeEmpty()->end() |
||
| 47 | ->scalarNode('path')->isRequired()->cannotBeEmpty()->end() |
||
| 48 | ->booleanNode('enabled')->defaultTrue()->end() |
||
| 49 | ->arrayNode('productCodes')->scalarPrototype()->end()->end() |
||
| 50 | ->arrayNode('sections')->scalarPrototype()->end()->end() |
||
| 51 | ->arrayNode('channels')->scalarPrototype()->end()->end() |
||
| 52 | ->arrayNode('translations') |
||
| 53 | ->arrayPrototype() |
||
| 54 | ->children() |
||
| 55 | ->scalarNode('name')->defaultNull()->end() |
||
| 56 | ->scalarNode('content')->defaultNull()->end() |
||
| 57 | ->scalarNode('alt')->defaultNull()->end() |
||
| 58 | ->scalarNode('link')->defaultNull()->end() |
||
| 59 | ->end() |
||
| 60 | ->end() |
||
| 61 | ->end() |
||
| 62 | ->end() |
||
| 63 | ->end() |
||
| 64 | ->end() |
||
| 65 | ->end() |
||
| 66 | ; |
||
| 67 | } |
||
| 68 | } |
||
| 69 |