| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace AppBundle\DataFixtures\ORM; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Application\Sonata\MediaBundle\Entity\Media; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Hautelook\AliceBundle\Alice\DataFixtureLoader; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | class LoadData extends DataFixtureLoader | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 9 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 10 |  |  |     protected function getFixtures() | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  |         return [ | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |             __DIR__.'/fixturesGalleryHasMedia_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |             __DIR__.'/fixturesEmployee_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |             __DIR__.'/fixturesHistory_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |             __DIR__.'/fixturesVenue_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |             __DIR__.'/fixturesVenueSector_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |             __DIR__.'/fixturesPriceCategory_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |             __DIR__.'/fixturesPerformance_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |             __DIR__.'/fixturesRole_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |             __DIR__.'/fixturesTag_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |             __DIR__.'/fixturesPost_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |             __DIR__.'/fixturesPerformanceEvent_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |             __DIR__.'/fixturesSeat_uk.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |             __DIR__.'/fixturesEmployeeTranslation_en.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |             __DIR__.'/fixturesVenueTranslation_en.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |             __DIR__.'/fixturesVenueSectorTranslation_en.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |             __DIR__.'/fixturesPriceCategoryTranslation_en.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |             __DIR__.'/fixturesPerformanceTranslation_en.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |             __DIR__.'/fixturesRoleTranslation_en.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |             __DIR__.'/fixturesPostTranslation_en.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |             __DIR__.'/fixturesHistoryTranslation_en.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |             __DIR__.'/fixturesTagTranslation_en.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |             __DIR__.'/fixturesGalleryHasMediaTranslation_en.yml', | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     public function getMedia($name, $context = 'default') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         $media = new Media(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $media->setBinaryContent(__DIR__.'/../data/'.$name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         $media->setContext($context); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         $media->setProviderName('sonata.media.provider.image'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         $this->container->get('sonata.media.manager.media')->save($media, true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         return $media; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 50 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 51 |  |  |  |