EventManager::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Itkg\DelayEventBundle\DomainManager;
4
5
use Doctrine\Common\Persistence\ObjectManager;
6
use Itkg\DelayEventBundle\Model\Event;
7
8
/**
9
 * Class EventManager
10
 */
11
class EventManager implements EventManagerInterface
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $class;
17
18
    /**
19
     * @var ObjectManager
20
     */
21
    protected $om;
22
23
    /**
24
     * @param string          $class
25
     * @param ObjectManager   $om
26
     */
27
    public function __construct($class, ObjectManager $om)
28
    {
29
        $this->class = $class;
30
        $this->om = $om;
31
    }
32
33
    /**
34
     * @param Event $event
35
     */
36
    public function save(Event $event)
37
    {
38
        $this->om->persist($event);
39
        $this->om->flush($event);
40
    }
41
42
    /**
43
     * @param Event $event
44
     */
45
    public function delete(Event $event)
46
    {
47
        $this->om->remove($event);
48
        $this->om->flush($event);
49
    }
50
}
51