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