Failed Conditions
Pull Request — master (#7130)
by Michael
12:28
created

LifecycleEventArgs   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
dl 0
loc 38
ccs 10
cts 12
cp 0.8333
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getObject() 0 3 1
A getObjectManager() 0 3 1
A __construct() 0 4 1
A getEntityManager() 0 3 1
A getEntity() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ORM\Event;
6
7
use Doctrine\Common\Persistence\Event\LifecycleEventArgs as BaseLifecycleEventArgs;
8
use Doctrine\ORM\EntityManagerInterface;
9
10
/**
11
 * Lifecycle Events are triggered by the UnitOfWork during lifecycle transitions
12
 * of entities.
13
 *
14
 * @link   www.doctrine-project.org
15
 */
16
class LifecycleEventArgs extends BaseLifecycleEventArgs
17
{
18
    /** @var object */
19
    private $entity;
20
21
    /** @var EntityManagerInterface */
22
    private $entityManager;
23
24 142
    public function __construct(object $entity, EntityManagerInterface $entityManager)
25
    {
26 142
        $this->entity        = $entity;
27 142
        $this->entityManager = $entityManager;
28 142
    }
29
30 2
    public function getObject() : object
31
    {
32 2
        return $this->entity;
33
    }
34
35
    /**
36
     * Retrieves associated Entity.
37
     */
38 1
    public function getEntity()
39
    {
40 1
        return $this->entity;
41
    }
42
43
    public function getObjectManager()
44
    {
45
        return $this->entityManager;
46
    }
47
48
    /**
49
     * Retrieves associated EntityManager.
50
     */
51 1
    public function getEntityManager()
52
    {
53 1
        return $this->entityManager;
54
    }
55
}
56