|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Superdesk Web Publisher Fixtures Bundle. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright 2015 Sourcefabric z.ú. and contributors. |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please see the |
|
9
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
|
10
|
|
|
* |
|
11
|
|
|
* @copyright 2015 Sourcefabric z.ú |
|
12
|
|
|
* @license http://www.superdesk.org/license |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace SWP\Bundle\FixturesBundle\DataFixtures\ORM; |
|
16
|
|
|
|
|
17
|
|
|
use Doctrine\Common\DataFixtures\FixtureInterface; |
|
18
|
|
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; |
|
19
|
|
|
use SWP\Bundle\CoreBundle\Model\Container; |
|
20
|
|
|
use SWP\Bundle\FixturesBundle\AbstractFixture; |
|
21
|
|
|
use Doctrine\Common\Persistence\ObjectManager; |
|
22
|
|
|
use SWP\Bundle\TemplatesSystemBundle\Model\ContainerWidget; |
|
23
|
|
|
|
|
24
|
|
|
class LoadContainersData extends AbstractFixture implements FixtureInterface, OrderedFixtureInterface |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* {@inheritdoc} |
|
28
|
|
|
*/ |
|
29
|
7 |
|
public function load(ObjectManager $manager) |
|
30
|
|
|
{ |
|
31
|
7 |
|
$env = $this->getEnvironment(); |
|
32
|
7 |
|
if ('test' !== $env) { |
|
33
|
|
|
$container1 = new Container(); |
|
34
|
|
|
$container1->setName('mainNav'); |
|
35
|
|
|
$container1->setType(1); |
|
36
|
|
|
$container1->setCssClass('container'); |
|
37
|
|
|
$container1->setVisible(true); |
|
38
|
|
|
$container1->setTenantCode('123abc'); |
|
39
|
|
|
|
|
40
|
|
|
$containerWidget1 = new ContainerWidget($container1, $this->getReference('menu_widget_main')); |
|
41
|
|
|
$manager->persist($containerWidget1); |
|
42
|
|
|
$container1->addWidget($containerWidget1); |
|
43
|
|
|
$manager->persist($container1); |
|
44
|
|
|
|
|
45
|
|
|
$container2 = new Container(); |
|
46
|
|
|
$container2->setName('footerNav'); |
|
47
|
|
|
$container2->setType(1); |
|
48
|
|
|
$container2->setCssClass('container'); |
|
49
|
|
|
$container2->setVisible(true); |
|
50
|
|
|
$container2->setTenantCode('123abc'); |
|
51
|
|
|
|
|
52
|
|
|
$containerWidget2 = new ContainerWidget($container2, $this->getReference('menu_widget_footer')); |
|
53
|
|
|
$manager->persist($containerWidget2); |
|
54
|
|
|
$container2->addWidget($containerWidget2); |
|
55
|
|
|
$manager->persist($container2); |
|
56
|
|
|
|
|
57
|
|
|
$manager->flush(); |
|
58
|
|
|
} else { |
|
59
|
7 |
|
$this->loadFixtures( |
|
60
|
|
|
[ |
|
61
|
7 |
|
'@SWPFixturesBundle/Resources/fixtures/ORM/'.$env.'/Container.yml', |
|
62
|
|
|
], |
|
63
|
|
|
$manager |
|
64
|
|
|
); |
|
65
|
|
|
} |
|
66
|
7 |
|
} |
|
67
|
|
|
|
|
68
|
7 |
|
public function getOrder() |
|
69
|
|
|
{ |
|
70
|
7 |
|
return 2; |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|