LifecycleEventArgs::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Persistence\Event;
6
7
use Doctrine\Common\EventArgs;
8
use Doctrine\Persistence\ObjectManager;
9
10
/**
11
 * Lifecycle Events are triggered by the UnitOfWork during lifecycle transitions
12
 * of entities.
13
 */
14
class LifecycleEventArgs extends EventArgs
15
{
16
    /** @var ObjectManager */
17
    private $objectManager;
18
19
    /** @var object */
20
    private $object;
21
22 4
    public function __construct(object $object, ObjectManager $objectManager)
23
    {
24 4
        $this->object        = $object;
25 4
        $this->objectManager = $objectManager;
26 4
    }
27
28
    /**
29
     * Retrieves the associated entity.
30
     *
31
     * @deprecated
32
     *
33
     * @return object
34
     */
35
    public function getEntity()
36
    {
37
        return $this->object;
38
    }
39
40
    /**
41
     * Retrieves the associated object.
42
     *
43
     * @return object
44
     */
45 3
    public function getObject()
46
    {
47 3
        return $this->object;
48
    }
49
50
    /**
51
     * Retrieves the associated ObjectManager.
52
     *
53
     * @return ObjectManager
54
     */
55
    public function getObjectManager()
56
    {
57
        return $this->objectManager;
58
    }
59
}
60