SoftDeleteableEntity   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 47
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setDeletedAt() 0 6 1
A getDeletedAt() 0 4 1
A isDeleted() 0 4 1
1
<?php
2
3
namespace CallCenter\Bundle\CommonBundle\Traits;
4
5
use DateTime;
6
use Doctrine\ORM\Mapping as ORM;
7
8
trait SoftDeleteableEntity
9
{
10
    /**
11
     * @var DateTime
12
     *
13
     * @ORM\Column(
14
     *      name="deleted_at",
15
     *      type="datetime",
16
     *      nullable=true
17
     * )
18
     */
19
    protected $deletedAt;
20
21
    /**
22
     * Sets deletedAt.
23
     *
24
     * @param Datetime|null $deletedAt
25
     *
26
     * @return $this
27
     */
28
    public function setDeletedAt(DateTime $deletedAt = null)
29
    {
30
        $this->deletedAt = $deletedAt;
31
32
        return $this;
33
    }
34
35
    /**
36
     * Returns deletedAt.
37
     *
38
     * @return DateTime
39
     */
40
    public function getDeletedAt()
41
    {
42
        return $this->deletedAt;
43
    }
44
45
    /**
46
     * Is deleted?
47
     *
48
     * @return bool
49
     */
50
    public function isDeleted()
51
    {
52
        return null !== $this->deletedAt;
53
    }
54
}
55