Completed
Push — master ( 1fd82f...d17e85 )
by Kirill
05:33
created

LoadWidgetData::load()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 19
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 27
ccs 19
cts 19
cp 1
rs 8.8571
c 1
b 0
f 0
cc 1
eloc 18
nc 1
nop 1
crap 1
1
<?php
2
3
namespace AppBundle\DataFixtures\ORM;
4
5
use AppBundle\Entity\Variable;
6
use Doctrine\Common\DataFixtures\FixtureInterface;
7
use Doctrine\Common\Persistence\ObjectManager;
8
use AppBundle\Entity\Widget;
9
10
class LoadWidgetData implements FixtureInterface
11
{
12 1
    public function load(ObjectManager $manager)
13
    {
14 1
        $variable = new Variable();
15
16 1
        $variable->setName('temperature');
17 1
        $variable->setDescription('test temperature metric');
18 1
        $variable->setSource('internal');
19 1
        $variable->setParser('Simple');
20 1
        $variable->setValue('20');
21
22 1
        $manager->persist($variable);
23
24 1
        $widget = new Widget();
25
26 1
        $widget->setName('temperature');
27 1
        $widget->setHeight(2);
28 1
        $widget->setType('value');
29 1
        $widget->setWidth(2);
30 1
        $widget->setX(0);
31 1
        $widget->setY(0);
32 1
        $widget->setVariable($variable);
33
34 1
        $manager->persist($widget);
35
36
37 1
        $manager->flush();
38 1
    }
39
}
40