| 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\SyliusCmsPlugin\Fixture; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use BitBag\SyliusCmsPlugin\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 FrequentlyAskedQuestionFixture extends AbstractFixture implements FixtureInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |      * @var FixtureFactoryInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     private $frequentlyAskedQuestionFixtureFactory; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * @param FixtureFactoryInterface $frequentlyAskedQuestionFixtureFactory | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     public function __construct(FixtureFactoryInterface $frequentlyAskedQuestionFixtureFactory) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         $this->frequentlyAskedQuestionFixtureFactory = $frequentlyAskedQuestionFixtureFactory; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     public function load(array $options): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         $this->frequentlyAskedQuestionFixtureFactory->load($options['custom']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     public function getName(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         return 'frequently_asked_question'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 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('position')->defaultNull()->end() | 
            
                                                        
            
                                    
            
            
                | 68 |  |  |                             ->arrayNode('translations') | 
            
                                                        
            
                                    
            
            
                | 69 |  |  |                                 ->prototype('array') | 
            
                                                        
            
                                    
            
            
                | 70 |  |  |                                     ->children() | 
            
                                                        
            
                                    
            
            
                | 71 |  |  |                                         ->scalarNode('question')->defaultNull()->end() | 
            
                                                        
            
                                    
            
            
                | 72 |  |  |                                         ->scalarNode('answer')->defaultNull()->end() | 
            
                                                        
            
                                    
            
            
                | 73 |  |  |                                     ->end() | 
            
                                                        
            
                                    
            
            
                | 74 |  |  |                                 ->end() | 
            
                                                        
            
                                    
            
            
                | 75 |  |  |                             ->end() | 
            
                                                        
            
                                    
            
            
                | 76 |  |  |                         ->end() | 
            
                                                        
            
                                    
            
            
                | 77 |  |  |                     ->end() | 
            
                                                        
            
                                    
            
            
                | 78 |  |  |                 ->end() | 
            
                                                        
            
                                    
            
            
                | 79 |  |  |             ->end() | 
            
                                                        
            
                                    
            
            
                | 80 |  |  |         ; | 
            
                                                        
            
                                    
            
            
                | 81 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 82 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 83 |  |  |  |