|
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\FixturesBundle\AbstractFixture; |
|
20
|
|
|
use Doctrine\Common\Persistence\ObjectManager; |
|
21
|
|
|
use SWP\Bundle\CoreBundle\Model\WidgetModel; |
|
22
|
|
|
use SWP\Component\MultiTenancy\Model\TenantInterface; |
|
23
|
|
|
|
|
24
|
|
|
class LoadWidgetsData extends AbstractFixture implements FixtureInterface, OrderedFixtureInterface |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* {@inheritdoc} |
|
28
|
|
|
*/ |
|
29
|
|
|
public function load(ObjectManager $manager) |
|
30
|
|
|
{ |
|
31
|
|
|
/** @var TenantInterface $tenant */ |
|
32
|
|
|
$tenant = $this->container->get('swp.repository.tenant')->findOneBySubdomain('default'); |
|
33
|
|
|
|
|
34
|
|
|
$widget = new WidgetModel(); |
|
35
|
|
|
$widget->setType(WidgetModel::TYPE_MENU); |
|
36
|
|
|
$widget->setName('NavigationMain'); |
|
37
|
|
|
$widget->setParameters([ |
|
38
|
|
|
'menu_name' => 'mainNavigation', |
|
39
|
|
|
'template_name' => 'menu1.html.twig', |
|
40
|
|
|
]); |
|
41
|
|
|
$widget->setTenantCode($tenant->getCode()); |
|
42
|
|
|
$manager->persist($widget); |
|
43
|
|
|
|
|
44
|
|
|
$this->addReference('menu_widget_main', $widget); |
|
45
|
|
|
|
|
46
|
|
|
$widget = new WidgetModel(); |
|
47
|
|
|
$widget->setType(WidgetModel::TYPE_MENU); |
|
48
|
|
|
$widget->setName('NavigationFooterPrim'); |
|
49
|
|
|
$widget->setParameters([ |
|
50
|
|
|
'menu_name' => 'footerPrim', |
|
51
|
|
|
'template_name' => 'menu2.html.twig', |
|
52
|
|
|
]); |
|
53
|
|
|
$widget->setTenantCode($tenant->getCode()); |
|
54
|
|
|
$manager->persist($widget); |
|
55
|
|
|
|
|
56
|
|
|
$manager->flush(); |
|
57
|
|
|
|
|
58
|
|
|
$this->addReference('menu_widget_footer', $widget); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function getOrder() |
|
62
|
|
|
{ |
|
63
|
|
|
return 1; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|