Role::getUpdatedAt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Potievdev\SlimRbac\Models\Entity;
4
5
use DateTime;
6
use Doctrine\ORM\Mapping as ORM;
7
8
/**
9
 * Role
10
 *
11
 * @ORM\Table(
12
 *     name="role",
13
 *     uniqueConstraints={@ORM\UniqueConstraint(name="idx_role_name", columns={"name"})},
14
 *     indexes={@ORM\Index(name="idx_role_parent_id", columns={"parent_id"})}
15
 * )
16
 * @ORM\Entity(repositoryClass="Potievdev\SlimRbac\Models\Repository\RoleRepository")
17
 * @ORM\HasLifecycleCallbacks
18
 */
19
class Role
20
{
21
    /**
22
     * @var integer
23
     *
24
     * @ORM\Column(name="id", type="integer", nullable=false)
25
     * @ORM\Id
26
     * @ORM\GeneratedValue(strategy="IDENTITY")
27
     */
28
    private $id;
29
30
    /**
31
     * @var string
32
     *
33
     * @ORM\Column(name="name", type="string", length=50, nullable=false)
34
     */
35
    private $name;
36
37
    /**
38
     * @var boolean
39
     *
40
     * @ORM\Column(name="status", type="boolean", nullable=false)
41
     */
42
    private $status = '1';
43
44
    /**
45
     * @var DateTime
46
     *
47
     * @ORM\Column(name="created_at", type="datetime", nullable=false)
48
     */
49
    private $createdAt;
50
51
    /**
52
     * @var DateTime
53
     *
54
     * @ORM\Column(name="updated_at", type="datetime", nullable=true)
55
     */
56
    private $updatedAt;
57
58
    /**
59
     * @var string
60
     *
61
     * @ORM\Column(name="description", type="string", nullable=true)
62
     */
63
    private $description;
64
65
    public function getId(): int
66
    {
67
        return $this->id;
68
    }
69
70
    public function setId(int $id)
71
    {
72
        $this->id = $id;
73
    }
74
75
    public function getName(): string
76
    {
77
        return $this->name;
78
    }
79
80
    public function setName(string $name)
81
    {
82
        $this->name = $name;
83
    }
84
85
    public function isStatus(): bool
86
    {
87
        return $this->status;
88
    }
89
90
    public function setStatus(bool $status)
91
    {
92
        $this->status = $status;
93
    }
94
95
    public function getCreatedAt(): DateTime
96
    {
97
        return $this->createdAt;
98
    }
99
100
    public function setCreatedAt(DateTime $createdAt)
101
    {
102
        $this->createdAt = $createdAt;
103
    }
104
105
    public function getUpdatedAt(): DateTime
106
    {
107
        return $this->updatedAt;
108
    }
109
110
    public function setUpdatedAt(DateTime $updatedAt)
111
    {
112
        $this->updatedAt = $updatedAt;
113
    }
114
115
    public function getDescription(): string
116
    {
117
        return $this->description;
118
    }
119
120
    public function setDescription(string $description)
121
    {
122
        $this->description = $description;
123
    }
124
125
    /** @ORM\PrePersist */
126
    public function prePersist()
127
    {
128
        $this->createdAt = new DateTime();
129
    }
130
131
    /** @ORM\PreUpdate */
132
    public function preUpdate()
133
    {
134
        $this->updatedAt = new DateTime();
135
    }
136
}
137