Completed
Push — feature/authentication_cleanup ( dfa3b9...c02d17 )
by Bastian
17:41 queued 02:00
created

LoadAppData::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 20
ccs 0
cts 16
cp 0
rs 9.4285
cc 1
eloc 14
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * /core/app fixtures for mongodb app collection.
4
 */
5
6
namespace Graviton\CoreBundle\DataFixtures\MongoDB;
7
8
use Doctrine\Common\DataFixtures\FixtureInterface;
9
use Doctrine\Common\Persistence\ObjectManager;
10
use Graviton\CoreBundle\Document\App;
11
12
/**
13
 * Load App data fixtures into mongodb
14
 *
15
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
16
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
17
 * @link     http://swisscom.ch
18
 */
19
class LoadAppData implements FixtureInterface
20
{
21
    /**
22
     * {@inheritDoc}
23
     *
24
     * @param ObjectManager $manager Object Manager
25
     *
26
     * @return void
27
     */
28
    public function load(ObjectManager $manager)
29
    {
30
        $tabletApp = new App;
31
        $tabletApp->setId('tablet');
32
        $tabletApp->setName('Tablet');
33
        $tabletApp->setShowInMenu(true);
34
        $tabletApp->setOrder(1);
35
36
        $manager->persist($tabletApp);
37
38
        $adminApp = new App;
39
        $adminApp->setId('admin');
40
        $adminApp->setName('Administration');
41
        $adminApp->setShowInMenu(true);
42
        $adminApp->setOrder(2);
43
44
        $manager->persist($adminApp);
45
46
        $manager->flush();
47
    }
48
}
49