1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\DataFixtures\ORM; |
4
|
|
|
|
5
|
|
|
use Application\Sonata\MediaBundle\Entity\Media; |
6
|
|
|
use Hautelook\AliceBundle\Alice\DataFixtureLoader; |
7
|
|
|
use Ramsey\Uuid\Uuid; |
8
|
|
|
|
9
|
|
|
class LoadData extends DataFixtureLoader |
10
|
|
|
{ |
11
|
|
|
protected function getFixtures() |
12
|
|
|
{ |
13
|
|
|
return [ |
14
|
|
|
__DIR__.'/fixturesGalleryHasMedia_uk.yml', |
15
|
|
|
__DIR__.'/fixturesEmployee_uk.yml', |
16
|
|
|
__DIR__.'/fixturesHistory_uk.yml', |
17
|
|
|
__DIR__.'/fixturesVenue_uk.yml', |
18
|
|
|
__DIR__.'/fixturesVenueSector_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__.'/fixturesPriceCategory_uk.yml', |
25
|
|
|
__DIR__.'/fixturesSeat_uk.yml', |
26
|
|
|
__DIR__.'/fixturesRowsForSale_uk.yml', |
27
|
|
|
__DIR__.'/fixturesEmployeeTranslation_en.yml', |
28
|
|
|
__DIR__.'/fixturesVenueTranslation_en.yml', |
29
|
|
|
__DIR__.'/fixturesVenueSectorTranslation_en.yml', |
30
|
|
|
__DIR__.'/fixturesPerformanceTranslation_en.yml', |
31
|
|
|
__DIR__.'/fixturesRoleTranslation_en.yml', |
32
|
|
|
__DIR__.'/fixturesPostTranslation_en.yml', |
33
|
|
|
__DIR__.'/fixturesHistoryTranslation_en.yml', |
34
|
|
|
__DIR__.'/fixturesTagTranslation_en.yml', |
35
|
|
|
__DIR__.'/fixturesGalleryHasMediaTranslation_en.yml', |
36
|
|
|
__DIR__.'/fixturesUser.yml', |
37
|
|
|
]; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function getMedia($name, $context = 'default') |
41
|
|
|
{ |
42
|
|
|
$media = new Media(); |
43
|
|
|
|
44
|
|
|
$media->setBinaryContent(__DIR__.'/../data/'.$name); |
45
|
|
|
$media->setContext($context); |
46
|
|
|
$media->setProviderName('sonata.media.provider.image'); |
47
|
|
|
|
48
|
|
|
$this->container->get('sonata.media.manager.media')->save($media, true); |
49
|
|
|
|
50
|
|
|
return $media; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Generate Uuid4 string |
55
|
|
|
* |
56
|
|
|
* @return string |
57
|
|
|
*/ |
58
|
|
|
public function generateUuidString() |
59
|
|
|
{ |
60
|
|
|
return Uuid::uuid4()->toString(); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|