Completed
Pull Request — experimental/3.1 (#2308)
by chihiro
43:22 queued 19:38
created

AbstractRepository::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
4
namespace Eccube\Repository;
5
6
7
use Doctrine\ORM\EntityRepository;
8
use Eccube\Application;
9
use Eccube\Common\Constant;
10
use Eccube\Entity\AbstractEntity;
11
12
class AbstractRepository extends EntityRepository
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
13
{
14
15
    protected $app;
16
17
    /**
18
     * @param Application $app
19
     */
20
    public function setApplication($app)
21
    {
22
        $this->app = $app;
23
    }
24
25
    /**
26
     * エンティティを削除します。
27
     * 物理削除ではなく、del_flgを利用した論理削除を行います。
28
     *
29
     * @param AbstractEntity $entity
30
     */
31
    public function delete($entity)
32
    {
33
        $entity->setDelFlg(Constant::ENABLED);
34
        $this->save($entity);
35
    }
36
37
    /**
0 ignored issues
show
introduced by
Doc comment for parameter "$entity" missing
Loading history...
38
     * エンティティの登録/保存します。
39
     *
40
     * @param $entity|AbstractEntity エンティティ
0 ignored issues
show
introduced by
Missing parameter name
Loading history...
41
     */
42
    public function save($entity)
43
    {
44
        $this->getEntityManager()->persist($entity);
45
    }
46
47
    protected function getCacheLifetime()
48
    {
49
        $options = $this->app['config']['doctrine_cache'];
50
        return $options['result_cache']['lifetime'];
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
51
    }
52
}