Completed
Pull Request — experimental/3.1 (#2515)
by Kentaro
147:20 queued 92:31
created

LoadEventSubscriber::postLoad()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Eccube\Doctrine\EventSubscriber;
4
5
use Doctrine\Common\EventSubscriber;
6
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
7
use Doctrine\ORM\Events;
8
use Eccube\Application;
9
use Eccube\Entity\AbstractEntity;
10
11
class LoadEventSubscriber implements EventSubscriber
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
12
{
13
    /**
14
     * @var Application
15
     */
16
    private $app;
17
18
    /**
19
     * @param Application $app
20
     */
21 1091
    public function __construct(Application $app)
22
    {
23 1091
        $this->app = $app;
24
    }
25
26 1091
    public function getSubscribedEvents()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
27
    {
28 1091
        return [Events::postLoad];
29
    }
30
31 1091
    public function postLoad(LifecycleEventArgs $args)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
32
    {
33 1091
        $entity = $args->getObject();
34 1091
        if ($entity instanceof AbstractEntity) {
35 1091
            $entity->setAnnotationReader($this->app['eccube.di.annotation_reader']);
36
        }
37
    }
38
}
39