1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* WebHemi. |
4
|
|
|
* |
5
|
|
|
* PHP version 7.1 |
6
|
|
|
* |
7
|
|
|
* @copyright 2012 - 2018 Gixx-web (http://www.gixx-web.com) |
8
|
|
|
* @license https://opensource.org/licenses/MIT The MIT License (MIT) |
9
|
|
|
* |
10
|
|
|
* @link http://www.gixx-web.com |
11
|
|
|
*/ |
12
|
|
|
declare(strict_types = 1); |
13
|
|
|
|
14
|
|
|
namespace WebHemi\Data\Entity; |
15
|
|
|
|
16
|
|
|
use WebHemi\DateTime; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class PolicyEntity |
20
|
|
|
*/ |
21
|
|
|
class PolicyEntity extends AbstractEntity |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var array |
25
|
|
|
*/ |
26
|
|
|
protected $container = [ |
27
|
|
|
'id_policy' => null, |
28
|
|
|
'fk_resource' => null, |
29
|
|
|
'fk_application' => null, |
30
|
|
|
'name' => null, |
31
|
|
|
'title' => null, |
32
|
|
|
'description' => null, |
33
|
|
|
'method' => null, |
34
|
|
|
'is_read_only' => null, |
35
|
|
|
'date_created' => null, |
36
|
|
|
'date_modified' => null, |
37
|
|
|
]; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param int $identifier |
41
|
|
|
* @return PolicyEntity |
42
|
|
|
*/ |
43
|
|
|
public function setPolicyId(int $identifier) : PolicyEntity |
44
|
|
|
{ |
45
|
|
|
$this->container['id_policy'] = $identifier; |
46
|
|
|
|
47
|
|
|
return $this; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return int|null |
52
|
|
|
*/ |
53
|
|
|
public function getPolicyId() : ? int |
54
|
|
|
{ |
55
|
|
|
return !is_null($this->container['id_policy']) |
56
|
|
|
? (int) $this->container['id_policy'] |
57
|
|
|
: null; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param int $resourceIdentifier |
62
|
|
|
* @return PolicyEntity |
63
|
|
|
*/ |
64
|
|
|
public function setResourceId(int $resourceIdentifier) : PolicyEntity |
65
|
|
|
{ |
66
|
|
|
$this->container['fk_resource'] = $resourceIdentifier; |
67
|
|
|
|
68
|
|
|
return $this; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return int|null |
73
|
|
|
*/ |
74
|
1 |
|
public function getResourceId() : ? int |
75
|
|
|
{ |
76
|
1 |
|
return !is_null($this->container['fk_resource']) |
77
|
1 |
|
? (int) $this->container['fk_resource'] |
78
|
1 |
|
: null; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param int $applicationIdentifier |
83
|
|
|
* @return PolicyEntity |
84
|
|
|
*/ |
85
|
|
|
public function setApplicationId(int $applicationIdentifier) : PolicyEntity |
86
|
|
|
{ |
87
|
|
|
$this->container['fk_application'] = $applicationIdentifier; |
88
|
|
|
|
89
|
|
|
return $this; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return int|null |
94
|
|
|
*/ |
95
|
1 |
|
public function getApplicationId() : ? int |
96
|
|
|
{ |
97
|
1 |
|
return !is_null($this->container['fk_application']) |
98
|
1 |
|
? (int) $this->container['fk_application'] |
99
|
1 |
|
: null; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param string $name |
104
|
|
|
* @return PolicyEntity |
105
|
|
|
*/ |
106
|
|
|
public function setName(string $name) : PolicyEntity |
107
|
|
|
{ |
108
|
|
|
$this->container['name'] = $name; |
109
|
|
|
|
110
|
|
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @return null|string |
115
|
|
|
*/ |
116
|
|
|
public function getName() : ? string |
117
|
|
|
{ |
118
|
|
|
return $this->container['name']; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @param string $title |
123
|
|
|
* @return PolicyEntity |
124
|
|
|
*/ |
125
|
|
|
public function setTitle(string $title) : PolicyEntity |
126
|
|
|
{ |
127
|
|
|
$this->container['title'] = $title; |
128
|
|
|
|
129
|
|
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @return null|string |
134
|
|
|
*/ |
135
|
|
|
public function getTitle() : ? string |
136
|
|
|
{ |
137
|
|
|
return $this->container['title']; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @param string $description |
142
|
|
|
* @return PolicyEntity |
143
|
|
|
*/ |
144
|
|
|
public function setDescription(string $description) : PolicyEntity |
145
|
|
|
{ |
146
|
|
|
$this->container['description'] = $description; |
147
|
|
|
|
148
|
|
|
return $this; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @return null|string |
153
|
|
|
*/ |
154
|
|
|
public function getDescription() : ? string |
155
|
|
|
{ |
156
|
|
|
return $this->container['description']; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @param string $method |
161
|
|
|
* @return PolicyEntity |
162
|
|
|
*/ |
163
|
|
|
public function setMethod(string $method) : PolicyEntity |
164
|
|
|
{ |
165
|
|
|
$this->container['method'] = $method; |
166
|
|
|
|
167
|
|
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @return null|string |
172
|
|
|
*/ |
173
|
1 |
|
public function getMethod() : ? string |
174
|
|
|
{ |
175
|
1 |
|
return $this->container['method']; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @param bool $isReadonly |
180
|
|
|
* @return PolicyEntity |
181
|
|
|
*/ |
182
|
|
|
public function setIsReadOnly(bool $isReadonly) : PolicyEntity |
183
|
|
|
{ |
184
|
|
|
$this->container['is_read_only'] = $isReadonly ? 1 : 0; |
185
|
|
|
|
186
|
|
|
return $this; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @return bool |
191
|
|
|
*/ |
192
|
|
|
public function getIsReadOnly() : bool |
193
|
|
|
{ |
194
|
|
|
return !empty($this->container['is_read_only']); |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @param DateTime $dateTime |
199
|
|
|
* @return PolicyEntity |
200
|
|
|
*/ |
201
|
|
|
public function setDateCreated(DateTime $dateTime) : PolicyEntity |
202
|
|
|
{ |
203
|
|
|
$this->container['date_created'] = $dateTime->format('Y-m-d H:i:s'); |
204
|
|
|
|
205
|
|
|
return $this; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* @return null|DateTime |
210
|
|
|
*/ |
211
|
|
|
public function getDateCreated() : ? DateTime |
212
|
|
|
{ |
213
|
|
|
return !empty($this->container['date_created']) |
214
|
|
|
? new DateTime($this->container['date_created']) |
215
|
|
|
: null; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @param DateTime $dateTime |
220
|
|
|
* @return PolicyEntity |
221
|
|
|
*/ |
222
|
|
|
public function setDateModified(DateTime $dateTime) : PolicyEntity |
223
|
|
|
{ |
224
|
|
|
$this->container['date_modified'] = $dateTime->format('Y-m-d H:i:s'); |
225
|
|
|
|
226
|
|
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return null|DateTime |
231
|
|
|
*/ |
232
|
|
|
public function getDateModified() : ? DateTime |
233
|
|
|
{ |
234
|
|
|
return !empty($this->container['date_modified']) |
235
|
|
|
? new DateTime($this->container['date_modified']) |
236
|
|
|
: null; |
237
|
|
|
} |
238
|
|
|
} |
239
|
|
|
|