Failed Conditions
Push — experimental/3.1 ( 94d0cd...3ded70 )
by chihiro
23s
created

AbstractRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
dl 0
loc 35
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 4 1
A save() 0 4 1
A getCacheLifetime() 0 5 1
1
<?php
2
3
4
namespace Eccube\Repository;
5
6
7
use Doctrine\ORM\EntityRepository;
8
use Eccube\Annotation\Inject;
9
use Eccube\Entity\AbstractEntity;
10
11
class AbstractRepository extends EntityRepository
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
12
{
13
    /**
14
     * @Inject("config")
15
     * @var array
16
     */
17
    protected $appConfig;
18
19
    /**
20
     * エンティティを削除します。
21
     * 物理削除ではなく、del_flgを利用した論理削除を行います。
22
     *
23
     * @param AbstractEntity $entity
24
     */
25 2
    public function delete($entity)
26
    {
27 2
        $this->getEntityManager()->remove($entity);
28
    }
29
30
    /**
0 ignored issues
show
introduced by
Doc comment for parameter "$entity" missing
Loading history...
31
     * エンティティの登録/保存します。
32
     *
33
     * @param $entity|AbstractEntity エンティティ
0 ignored issues
show
introduced by
Missing parameter name
Loading history...
34
     */
35
    public function save($entity)
36
    {
37
        $this->getEntityManager()->persist($entity);
38
    }
39
40 1094
    protected function getCacheLifetime()
41
    {
42 1094
        $options = $this->appConfig['doctrine_cache'];
43 1094
        return $options['result_cache']['lifetime'];
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
44
    }
45
}
46