1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SWP\Bundle\FixturesBundle\Registry; |
4
|
|
|
|
5
|
|
|
class FixtureRegistry |
6
|
|
|
{ |
7
|
|
|
private $environment; |
8
|
|
|
|
9
|
103 |
|
public function getFixtures(array $fixtureNames) |
10
|
|
|
{ |
11
|
|
|
// this array can be moved to config file |
12
|
|
|
$fixtures = [ |
13
|
|
|
'doctrine_phpcr' => [ |
14
|
|
|
'tenant' => 'SWP\Bundle\FixturesBundle\DataFixtures\PHPCR\LoadTenantsData', |
15
|
|
|
'article' => 'SWP\Bundle\FixturesBundle\DataFixtures\PHPCR\LoadArticlesData', |
16
|
|
|
'article_media' => 'SWP\Bundle\FixturesBundle\DataFixtures\PHPCR\LoadArticlesMediaData', |
17
|
|
|
'separate_article' => 'SWP\Bundle\FixturesBundle\DataFixtures\PHPCR\LoadSeparateArticlesData', |
18
|
|
|
'route' => 'SWP\Bundle\FixturesBundle\DataFixtures\PHPCR\LoadRoutesData', |
19
|
|
|
'collection_route' => 'SWP\Bundle\FixturesBundle\DataFixtures\PHPCR\LoadCollectionRouteArticles', |
20
|
|
|
'homepage' => 'SWP\Bundle\FixturesBundle\DataFixtures\PHPCR\LoadHomepagesData', |
21
|
|
|
'menu' => 'SWP\Bundle\FixturesBundle\DataFixtures\PHPCR\LoadMenusData', |
22
|
|
|
'menu_node' => 'SWP\Bundle\FixturesBundle\DataFixtures\PHPCR\LoadMenuNodesData', |
23
|
103 |
|
], |
24
|
|
|
'doctrine' => [ |
25
|
|
|
'tenant' => 'SWP\Bundle\FixturesBundle\DataFixtures\ORM\LoadTenantsData', |
26
|
|
|
'article' => 'SWP\Bundle\FixturesBundle\DataFixtures\ORM\LoadArticlesData', |
27
|
|
|
'article_media' => 'SWP\Bundle\FixturesBundle\DataFixtures\ORM\LoadArticlesMediaData', |
28
|
|
|
'separate_article' => 'SWP\Bundle\FixturesBundle\DataFixtures\ORM\LoadSeparateArticlesData', |
29
|
|
|
'rule' => 'SWP\Bundle\FixturesBundle\DataFixtures\ORM\LoadRulesData', |
30
|
|
|
'route' => 'SWP\Bundle\FixturesBundle\DataFixtures\ORM\LoadRoutesData', |
31
|
|
|
'collection_route' => 'SWP\Bundle\FixturesBundle\DataFixtures\ORM\LoadCollectionRouteArticles', |
32
|
|
|
'menu' => 'SWP\Bundle\FixturesBundle\DataFixtures\ORM\LoadMenusData', |
33
|
|
|
'menu_node' => 'SWP\Bundle\FixturesBundle\DataFixtures\ORM\LoadMenuNodesData', |
34
|
|
|
], |
35
|
|
|
]; |
36
|
|
|
|
37
|
103 |
|
$result = []; |
38
|
103 |
|
foreach ($fixtures[$this->environment] as $key => $fixture) { |
39
|
103 |
|
foreach ($fixtureNames as $fixtureName) { |
40
|
103 |
|
if ($key === $fixtureName) { |
41
|
103 |
|
$result[] = $fixture; |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
|
46
|
103 |
|
return $result; |
47
|
|
|
} |
48
|
|
|
|
49
|
103 |
|
public function setEnvironment($env) |
50
|
|
|
{ |
51
|
103 |
|
$this->environment = $env; |
52
|
103 |
|
} |
53
|
|
|
} |
54
|
|
|
|