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

LoadEventSubscriber::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
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