1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PiouPiou\RibsAdminBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* AccessRight |
12
|
|
|
* |
13
|
|
|
* @ORM\Table(name="access_right", uniqueConstraints={@ORM\UniqueConstraint(name="guid_UNIQUE", columns={"guid"})}) |
14
|
|
|
* @ORM\Entity(repositoryClass="PiouPiou\RibsAdminBundle\Repository\AccessRightRepository") |
15
|
|
|
* @ORM\EntityListeners({"PiouPiou\RibsAdminBundle\EventListener\GuidAwareListener"}) |
16
|
|
|
*/ |
17
|
|
|
class AccessRight |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var integer |
21
|
|
|
* |
22
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true}) |
23
|
|
|
* @ORM\Id |
24
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
25
|
|
|
*/ |
26
|
|
|
private $id; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var string |
30
|
|
|
* |
31
|
|
|
* @ORM\Column(name="guid", type="string", length=255, nullable=false) |
32
|
|
|
*/ |
33
|
|
|
private $guid; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var string |
37
|
|
|
* |
38
|
|
|
* @ORM\Column(name="name", type="string", length=255, nullable=false) |
39
|
|
|
*/ |
40
|
|
|
private $name; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
* |
45
|
|
|
* @ORM\Column(name="access_rights", type="text", nullable=true) |
46
|
|
|
*/ |
47
|
|
|
private $accessRights; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var \DateTime |
51
|
|
|
* |
52
|
|
|
* @Gedmo\Timestampable(on="create") |
53
|
|
|
* @ORM\Column(name="creation_date", type="date", nullable=true) |
54
|
|
|
*/ |
55
|
|
|
private $creationDate; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var \DateTime |
59
|
|
|
* |
60
|
|
|
* @Gedmo\Timestampable(on="update") |
61
|
|
|
* @ORM\Column(name="update_date", type="date", nullable=true) |
62
|
|
|
*/ |
63
|
|
|
private $updateDate; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var ArrayCollection |
67
|
|
|
* |
68
|
|
|
* @ORM\OneToMany(targetEntity="PiouPiou\RibsAdminBundle\Entity\User", mappedBy="accessRightList") |
69
|
|
|
*/ |
70
|
|
|
private $users; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* AccessRight constructor. |
74
|
|
|
*/ |
75
|
|
|
public function __construct() |
76
|
|
|
{ |
77
|
|
|
$this->users = new ArrayCollection(); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return int |
82
|
|
|
*/ |
83
|
|
|
public function getId() |
84
|
|
|
{ |
85
|
|
|
return $this->id; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @param int $id |
90
|
|
|
*/ |
91
|
|
|
public function setId(int $id) |
92
|
|
|
{ |
93
|
|
|
$this->id = $id; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
|
|
public function getGuid() |
100
|
|
|
{ |
101
|
|
|
return $this->guid; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param string $guid |
106
|
|
|
*/ |
107
|
|
|
public function setGuid(string $guid) |
108
|
|
|
{ |
109
|
|
|
$this->guid = $guid; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return string |
114
|
|
|
*/ |
115
|
|
|
public function getName() |
116
|
|
|
{ |
117
|
|
|
return $this->name; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param string $name |
122
|
|
|
*/ |
123
|
|
|
public function setName(string $name) |
124
|
|
|
{ |
125
|
|
|
$this->name = $name; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return string |
130
|
|
|
*/ |
131
|
|
|
public function getAccessRights() |
132
|
|
|
{ |
133
|
|
|
return $this->accessRights; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @param string $accessRights |
138
|
|
|
*/ |
139
|
|
|
public function setAccessRights(string $accessRights) |
140
|
|
|
{ |
141
|
|
|
$this->accessRights = $accessRights; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @return \DateTime |
146
|
|
|
*/ |
147
|
|
|
public function getCreationDate() |
148
|
|
|
{ |
149
|
|
|
return $this->creationDate; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @param \DateTime $creationDate |
154
|
|
|
*/ |
155
|
|
|
public function setCreationDate(\DateTime $creationDate) |
156
|
|
|
{ |
157
|
|
|
$this->creationDate = $creationDate; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @return \DateTime |
162
|
|
|
*/ |
163
|
|
|
public function getUpdateDate() |
164
|
|
|
{ |
165
|
|
|
return $this->updateDate; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @param \DateTime $updateDate |
170
|
|
|
*/ |
171
|
|
|
public function setUpdateDate(\DateTime $updateDate) |
172
|
|
|
{ |
173
|
|
|
$this->updateDate = $updateDate; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @return ArrayCollection |
178
|
|
|
*/ |
179
|
|
|
public function getUsers() |
180
|
|
|
{ |
181
|
|
|
return $this->users; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @param User $user |
186
|
|
|
* @return $this |
187
|
|
|
*/ |
188
|
|
|
public function addUser(User $user) |
189
|
|
|
{ |
190
|
|
|
$this->users[] = $user; |
191
|
|
|
|
192
|
|
|
return $this; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @param User $user |
197
|
|
|
*/ |
198
|
|
|
public function removeUser(User $user) |
199
|
|
|
{ |
200
|
|
|
$this->users->removeElement($user); |
201
|
|
|
} |
202
|
|
|
} |