Completed
Pull Request — master (#50)
by Jonathan
04:19 queued 02:16
created

LifecycleEventArgs   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 38
ccs 6
cts 10
cp 0.6
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getEntity() 0 3 1
A __construct() 0 4 1
A getObjectManager() 0 3 1
A getObject() 0 3 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
    public function getEntity() : object
34
    {
35
        return $this->object;
36
    }
37
38
    /**
39
     * Retrieves the associated object.
40
     */
41 3
    public function getObject() : object
42
    {
43 3
        return $this->object;
44
    }
45
46
    /**
47
     * Retrieves the associated ObjectManager.
48
     */
49
    public function getObjectManager() : ObjectManager
50
    {
51
        return $this->objectManager;
52
    }
53
}
54