Completed
Push — master ( df1f12...4872e5 )
by Lucas
05:42
created

LoadAppData::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 1.0002
Metric Value
dl 0
loc 20
ccs 15
cts 16
cp 0.9375
rs 9.4285
cc 1
eloc 14
nc 1
nop 1
crap 1.0002
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 57
    public function load(ObjectManager $manager)
29
    {
30 57
        $tabletApp = new App;
31 57
        $tabletApp->setId('tablet');
32 57
        $tabletApp->setName('Tablet');
33 57
        $tabletApp->setShowInMenu(true);
34 57
        $tabletApp->setOrder(1);
35
36 57
        $manager->persist($tabletApp);
37
38 57
        $adminApp = new App;
39 57
        $adminApp->setId('admin');
40 57
        $adminApp->setName('Administration');
41 57
        $adminApp->setShowInMenu(true);
42 57
        $adminApp->setOrder(2);
43
44 57
        $manager->persist($adminApp);
45
46 57
        $manager->flush();
47 57
    }
48
}
49