1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Zemit Framework. |
4
|
|
|
* |
5
|
|
|
* (c) Zemit Team <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE.txt |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
declare(strict_types=1); |
12
|
|
|
|
13
|
|
|
namespace Zemit\Models\Abstracts; |
14
|
|
|
|
15
|
|
|
use Phalcon\Db\RawValue; |
16
|
|
|
use Zemit\Filter\Validation; |
17
|
|
|
use Zemit\Models\AbstractModel; |
18
|
|
|
use Zemit\Models\GroupRole; |
19
|
|
|
use Zemit\Models\Group; |
20
|
|
|
use Zemit\Models\RoleFeature; |
21
|
|
|
use Zemit\Models\Feature; |
22
|
|
|
use Zemit\Models\UserRole; |
23
|
|
|
use Zemit\Models\User; |
24
|
|
|
use Zemit\Models\Abstracts\Interfaces\RoleAbstractInterface; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Class RoleAbstract |
28
|
|
|
* |
29
|
|
|
* This class defines a Role abstract model that extends the AbstractModel class and implements the RoleAbstractInterface. |
30
|
|
|
* It provides properties and methods for managing Role data. |
31
|
|
|
* |
32
|
|
|
* @property GroupRole[] $grouprolelist |
33
|
|
|
* @property GroupRole[] $GroupRoleList |
34
|
|
|
* @method GroupRole[] getGroupRoleList(?array $params = null) |
35
|
|
|
* |
36
|
|
|
* @property Group[] $grouplist |
37
|
|
|
* @property Group[] $GroupList |
38
|
|
|
* @method Group[] getGroupList(?array $params = null) |
39
|
|
|
* |
40
|
|
|
* @property RoleFeature[] $rolefeaturelist |
41
|
|
|
* @property RoleFeature[] $RoleFeatureList |
42
|
|
|
* @method RoleFeature[] getRoleFeatureList(?array $params = null) |
43
|
|
|
* |
44
|
|
|
* @property Feature[] $featurelist |
45
|
|
|
* @property Feature[] $FeatureList |
46
|
|
|
* @method Feature[] getFeatureList(?array $params = null) |
47
|
|
|
* |
48
|
|
|
* @property UserRole[] $userrolelist |
49
|
|
|
* @property UserRole[] $UserRoleList |
50
|
|
|
* @method UserRole[] getUserRoleList(?array $params = null) |
51
|
|
|
* |
52
|
|
|
* @property User[] $userlist |
53
|
|
|
* @property User[] $UserList |
54
|
|
|
* @method User[] getUserList(?array $params = null) |
55
|
|
|
* |
56
|
|
|
* @property User $createdbyentity |
57
|
|
|
* @property User $CreatedByEntity |
58
|
|
|
* @method User getCreatedByEntity(?array $params = null) |
59
|
|
|
* |
60
|
|
|
* @property User $createdasentity |
61
|
|
|
* @property User $CreatedAsEntity |
62
|
|
|
* @method User getCreatedAsEntity(?array $params = null) |
63
|
|
|
* |
64
|
|
|
* @property User $updatedbyentity |
65
|
|
|
* @property User $UpdatedByEntity |
66
|
|
|
* @method User getUpdatedByEntity(?array $params = null) |
67
|
|
|
* |
68
|
|
|
* @property User $updatedasentity |
69
|
|
|
* @property User $UpdatedAsEntity |
70
|
|
|
* @method User getUpdatedAsEntity(?array $params = null) |
71
|
|
|
* |
72
|
|
|
* @property User $deletedasentity |
73
|
|
|
* @property User $DeletedAsEntity |
74
|
|
|
* @method User getDeletedAsEntity(?array $params = null) |
75
|
|
|
* |
76
|
|
|
* @property User $deletedbyentity |
77
|
|
|
* @property User $DeletedByEntity |
78
|
|
|
* @method User getDeletedByEntity(?array $params = null) |
79
|
|
|
* |
80
|
|
|
* @property User $restoredbyentity |
81
|
|
|
* @property User $RestoredByEntity |
82
|
|
|
* @method User getRestoredByEntity(?array $params = null) |
83
|
|
|
* |
84
|
|
|
* @property User $restoredasentity |
85
|
|
|
* @property User $RestoredAsEntity |
86
|
|
|
* @method User getRestoredAsEntity(?array $params = null) |
87
|
|
|
*/ |
88
|
|
|
abstract class RoleAbstract extends AbstractModel implements RoleAbstractInterface |
89
|
|
|
{ |
90
|
|
|
/** |
91
|
|
|
* Column: id |
92
|
|
|
* Attributes: First | Primary | NotNull | Numeric | Unsigned | AutoIncrement |
93
|
|
|
* @var mixed |
94
|
|
|
*/ |
95
|
|
|
public mixed $id = null; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Column: index |
99
|
|
|
* Attributes: NotNull | Size(50) | Type(2) |
100
|
|
|
* @var mixed |
101
|
|
|
*/ |
102
|
|
|
public mixed $index = null; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Column: label |
106
|
|
|
* Attributes: NotNull | Size(100) | Type(2) |
107
|
|
|
* @var mixed |
108
|
|
|
*/ |
109
|
|
|
public mixed $label = null; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Column: position |
113
|
|
|
* Attributes: NotNull | Numeric | Unsigned |
114
|
|
|
* @var mixed |
115
|
|
|
*/ |
116
|
|
|
public mixed $position = 0; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Column: deleted |
120
|
|
|
* Attributes: NotNull | Numeric | Unsigned | Type(26) |
121
|
|
|
* @var mixed |
122
|
|
|
*/ |
123
|
|
|
public mixed $deleted = 0; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Column: created_at |
127
|
|
|
* Attributes: NotNull | Type(4) |
128
|
|
|
* @var mixed |
129
|
|
|
*/ |
130
|
|
|
public mixed $createdAt = null; |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Column: created_by |
134
|
|
|
* Attributes: Numeric | Unsigned |
135
|
|
|
* @var mixed |
136
|
|
|
*/ |
137
|
|
|
public mixed $createdBy = null; |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Column: created_as |
141
|
|
|
* Attributes: Numeric | Unsigned |
142
|
|
|
* @var mixed |
143
|
|
|
*/ |
144
|
|
|
public mixed $createdAs = null; |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Column: updated_at |
148
|
|
|
* Attributes: Type(4) |
149
|
|
|
* @var mixed |
150
|
|
|
*/ |
151
|
|
|
public mixed $updatedAt = null; |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Column: updated_by |
155
|
|
|
* Attributes: Numeric | Unsigned |
156
|
|
|
* @var mixed |
157
|
|
|
*/ |
158
|
|
|
public mixed $updatedBy = null; |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Column: updated_as |
162
|
|
|
* Attributes: Numeric | Unsigned |
163
|
|
|
* @var mixed |
164
|
|
|
*/ |
165
|
|
|
public mixed $updatedAs = null; |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Column: deleted_at |
169
|
|
|
* Attributes: Type(4) |
170
|
|
|
* @var mixed |
171
|
|
|
*/ |
172
|
|
|
public mixed $deletedAt = null; |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* Column: deleted_as |
176
|
|
|
* Attributes: Numeric | Unsigned |
177
|
|
|
* @var mixed |
178
|
|
|
*/ |
179
|
|
|
public mixed $deletedAs = null; |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* Column: deleted_by |
183
|
|
|
* Attributes: Numeric | Unsigned |
184
|
|
|
* @var mixed |
185
|
|
|
*/ |
186
|
|
|
public mixed $deletedBy = null; |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Column: restored_at |
190
|
|
|
* Attributes: Type(4) |
191
|
|
|
* @var mixed |
192
|
|
|
*/ |
193
|
|
|
public mixed $restoredAt = null; |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* Column: restored_by |
197
|
|
|
* Attributes: Numeric | Unsigned |
198
|
|
|
* @var mixed |
199
|
|
|
*/ |
200
|
|
|
public mixed $restoredBy = null; |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Column: restored_as |
204
|
|
|
* Attributes: Numeric | Unsigned |
205
|
|
|
* @var mixed |
206
|
|
|
*/ |
207
|
|
|
public mixed $restoredAs = null; |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* Returns the value of field id |
211
|
|
|
* Column: id |
212
|
|
|
* Attributes: First | Primary | NotNull | Numeric | Unsigned | AutoIncrement |
213
|
|
|
* @return mixed |
214
|
|
|
*/ |
215
|
1 |
|
public function getId(): mixed |
216
|
|
|
{ |
217
|
1 |
|
return $this->id; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* Sets the value of field id |
222
|
|
|
* Column: id |
223
|
|
|
* Attributes: First | Primary | NotNull | Numeric | Unsigned | AutoIncrement |
224
|
|
|
* @param mixed $id |
225
|
|
|
* @return void |
226
|
|
|
*/ |
227
|
1 |
|
public function setId(mixed $id): void |
228
|
|
|
{ |
229
|
1 |
|
$this->id = $id; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* Returns the value of field index |
234
|
|
|
* Column: index |
235
|
|
|
* Attributes: NotNull | Size(50) | Type(2) |
236
|
|
|
* @return mixed |
237
|
|
|
*/ |
238
|
1 |
|
public function getIndex(): mixed |
239
|
|
|
{ |
240
|
1 |
|
return $this->index; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* Sets the value of field index |
245
|
|
|
* Column: index |
246
|
|
|
* Attributes: NotNull | Size(50) | Type(2) |
247
|
|
|
* @param mixed $index |
248
|
|
|
* @return void |
249
|
|
|
*/ |
250
|
1 |
|
public function setIndex(mixed $index): void |
251
|
|
|
{ |
252
|
1 |
|
$this->index = $index; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* Returns the value of field label |
257
|
|
|
* Column: label |
258
|
|
|
* Attributes: NotNull | Size(100) | Type(2) |
259
|
|
|
* @return mixed |
260
|
|
|
*/ |
261
|
1 |
|
public function getLabel(): mixed |
262
|
|
|
{ |
263
|
1 |
|
return $this->label; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
/** |
267
|
|
|
* Sets the value of field label |
268
|
|
|
* Column: label |
269
|
|
|
* Attributes: NotNull | Size(100) | Type(2) |
270
|
|
|
* @param mixed $label |
271
|
|
|
* @return void |
272
|
|
|
*/ |
273
|
1 |
|
public function setLabel(mixed $label): void |
274
|
|
|
{ |
275
|
1 |
|
$this->label = $label; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* Returns the value of field position |
280
|
|
|
* Column: position |
281
|
|
|
* Attributes: NotNull | Numeric | Unsigned |
282
|
|
|
* @return mixed |
283
|
|
|
*/ |
284
|
1 |
|
public function getPosition(): mixed |
285
|
|
|
{ |
286
|
1 |
|
return $this->position; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* Sets the value of field position |
291
|
|
|
* Column: position |
292
|
|
|
* Attributes: NotNull | Numeric | Unsigned |
293
|
|
|
* @param mixed $position |
294
|
|
|
* @return void |
295
|
|
|
*/ |
296
|
|
|
public function setPosition(mixed $position): void |
297
|
|
|
{ |
298
|
|
|
$this->position = $position; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* Returns the value of field deleted |
303
|
|
|
* Column: deleted |
304
|
|
|
* Attributes: NotNull | Numeric | Unsigned | Type(26) |
305
|
|
|
* @return mixed |
306
|
|
|
*/ |
307
|
1 |
|
public function getDeleted(): mixed |
308
|
|
|
{ |
309
|
1 |
|
return $this->deleted; |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* Sets the value of field deleted |
314
|
|
|
* Column: deleted |
315
|
|
|
* Attributes: NotNull | Numeric | Unsigned | Type(26) |
316
|
|
|
* @param mixed $deleted |
317
|
|
|
* @return void |
318
|
|
|
*/ |
319
|
|
|
public function setDeleted(mixed $deleted): void |
320
|
|
|
{ |
321
|
|
|
$this->deleted = $deleted; |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* Returns the value of field createdAt |
326
|
|
|
* Column: created_at |
327
|
|
|
* Attributes: NotNull | Type(4) |
328
|
|
|
* @return mixed |
329
|
|
|
*/ |
330
|
1 |
|
public function getCreatedAt(): mixed |
331
|
|
|
{ |
332
|
1 |
|
return $this->createdAt; |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* Sets the value of field createdAt |
337
|
|
|
* Column: created_at |
338
|
|
|
* Attributes: NotNull | Type(4) |
339
|
|
|
* @param mixed $createdAt |
340
|
|
|
* @return void |
341
|
|
|
*/ |
342
|
|
|
public function setCreatedAt(mixed $createdAt): void |
343
|
|
|
{ |
344
|
|
|
$this->createdAt = $createdAt; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* Returns the value of field createdBy |
349
|
|
|
* Column: created_by |
350
|
|
|
* Attributes: Numeric | Unsigned |
351
|
|
|
* @return mixed |
352
|
|
|
*/ |
353
|
1 |
|
public function getCreatedBy(): mixed |
354
|
|
|
{ |
355
|
1 |
|
return $this->createdBy; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* Sets the value of field createdBy |
360
|
|
|
* Column: created_by |
361
|
|
|
* Attributes: Numeric | Unsigned |
362
|
|
|
* @param mixed $createdBy |
363
|
|
|
* @return void |
364
|
|
|
*/ |
365
|
|
|
public function setCreatedBy(mixed $createdBy): void |
366
|
|
|
{ |
367
|
|
|
$this->createdBy = $createdBy; |
368
|
|
|
} |
369
|
|
|
|
370
|
|
|
/** |
371
|
|
|
* Returns the value of field createdAs |
372
|
|
|
* Column: created_as |
373
|
|
|
* Attributes: Numeric | Unsigned |
374
|
|
|
* @return mixed |
375
|
|
|
*/ |
376
|
1 |
|
public function getCreatedAs(): mixed |
377
|
|
|
{ |
378
|
1 |
|
return $this->createdAs; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* Sets the value of field createdAs |
383
|
|
|
* Column: created_as |
384
|
|
|
* Attributes: Numeric | Unsigned |
385
|
|
|
* @param mixed $createdAs |
386
|
|
|
* @return void |
387
|
|
|
*/ |
388
|
|
|
public function setCreatedAs(mixed $createdAs): void |
389
|
|
|
{ |
390
|
|
|
$this->createdAs = $createdAs; |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
/** |
394
|
|
|
* Returns the value of field updatedAt |
395
|
|
|
* Column: updated_at |
396
|
|
|
* Attributes: Type(4) |
397
|
|
|
* @return mixed |
398
|
|
|
*/ |
399
|
1 |
|
public function getUpdatedAt(): mixed |
400
|
|
|
{ |
401
|
1 |
|
return $this->updatedAt; |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
/** |
405
|
|
|
* Sets the value of field updatedAt |
406
|
|
|
* Column: updated_at |
407
|
|
|
* Attributes: Type(4) |
408
|
|
|
* @param mixed $updatedAt |
409
|
|
|
* @return void |
410
|
|
|
*/ |
411
|
|
|
public function setUpdatedAt(mixed $updatedAt): void |
412
|
|
|
{ |
413
|
|
|
$this->updatedAt = $updatedAt; |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
/** |
417
|
|
|
* Returns the value of field updatedBy |
418
|
|
|
* Column: updated_by |
419
|
|
|
* Attributes: Numeric | Unsigned |
420
|
|
|
* @return mixed |
421
|
|
|
*/ |
422
|
1 |
|
public function getUpdatedBy(): mixed |
423
|
|
|
{ |
424
|
1 |
|
return $this->updatedBy; |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
/** |
428
|
|
|
* Sets the value of field updatedBy |
429
|
|
|
* Column: updated_by |
430
|
|
|
* Attributes: Numeric | Unsigned |
431
|
|
|
* @param mixed $updatedBy |
432
|
|
|
* @return void |
433
|
|
|
*/ |
434
|
|
|
public function setUpdatedBy(mixed $updatedBy): void |
435
|
|
|
{ |
436
|
|
|
$this->updatedBy = $updatedBy; |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* Returns the value of field updatedAs |
441
|
|
|
* Column: updated_as |
442
|
|
|
* Attributes: Numeric | Unsigned |
443
|
|
|
* @return mixed |
444
|
|
|
*/ |
445
|
1 |
|
public function getUpdatedAs(): mixed |
446
|
|
|
{ |
447
|
1 |
|
return $this->updatedAs; |
448
|
|
|
} |
449
|
|
|
|
450
|
|
|
/** |
451
|
|
|
* Sets the value of field updatedAs |
452
|
|
|
* Column: updated_as |
453
|
|
|
* Attributes: Numeric | Unsigned |
454
|
|
|
* @param mixed $updatedAs |
455
|
|
|
* @return void |
456
|
|
|
*/ |
457
|
|
|
public function setUpdatedAs(mixed $updatedAs): void |
458
|
|
|
{ |
459
|
|
|
$this->updatedAs = $updatedAs; |
460
|
|
|
} |
461
|
|
|
|
462
|
|
|
/** |
463
|
|
|
* Returns the value of field deletedAt |
464
|
|
|
* Column: deleted_at |
465
|
|
|
* Attributes: Type(4) |
466
|
|
|
* @return mixed |
467
|
|
|
*/ |
468
|
1 |
|
public function getDeletedAt(): mixed |
469
|
|
|
{ |
470
|
1 |
|
return $this->deletedAt; |
471
|
|
|
} |
472
|
|
|
|
473
|
|
|
/** |
474
|
|
|
* Sets the value of field deletedAt |
475
|
|
|
* Column: deleted_at |
476
|
|
|
* Attributes: Type(4) |
477
|
|
|
* @param mixed $deletedAt |
478
|
|
|
* @return void |
479
|
|
|
*/ |
480
|
|
|
public function setDeletedAt(mixed $deletedAt): void |
481
|
|
|
{ |
482
|
|
|
$this->deletedAt = $deletedAt; |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
/** |
486
|
|
|
* Returns the value of field deletedAs |
487
|
|
|
* Column: deleted_as |
488
|
|
|
* Attributes: Numeric | Unsigned |
489
|
|
|
* @return mixed |
490
|
|
|
*/ |
491
|
1 |
|
public function getDeletedAs(): mixed |
492
|
|
|
{ |
493
|
1 |
|
return $this->deletedAs; |
494
|
|
|
} |
495
|
|
|
|
496
|
|
|
/** |
497
|
|
|
* Sets the value of field deletedAs |
498
|
|
|
* Column: deleted_as |
499
|
|
|
* Attributes: Numeric | Unsigned |
500
|
|
|
* @param mixed $deletedAs |
501
|
|
|
* @return void |
502
|
|
|
*/ |
503
|
|
|
public function setDeletedAs(mixed $deletedAs): void |
504
|
|
|
{ |
505
|
|
|
$this->deletedAs = $deletedAs; |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
/** |
509
|
|
|
* Returns the value of field deletedBy |
510
|
|
|
* Column: deleted_by |
511
|
|
|
* Attributes: Numeric | Unsigned |
512
|
|
|
* @return mixed |
513
|
|
|
*/ |
514
|
1 |
|
public function getDeletedBy(): mixed |
515
|
|
|
{ |
516
|
1 |
|
return $this->deletedBy; |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
/** |
520
|
|
|
* Sets the value of field deletedBy |
521
|
|
|
* Column: deleted_by |
522
|
|
|
* Attributes: Numeric | Unsigned |
523
|
|
|
* @param mixed $deletedBy |
524
|
|
|
* @return void |
525
|
|
|
*/ |
526
|
|
|
public function setDeletedBy(mixed $deletedBy): void |
527
|
|
|
{ |
528
|
|
|
$this->deletedBy = $deletedBy; |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
/** |
532
|
|
|
* Returns the value of field restoredAt |
533
|
|
|
* Column: restored_at |
534
|
|
|
* Attributes: Type(4) |
535
|
|
|
* @return mixed |
536
|
|
|
*/ |
537
|
1 |
|
public function getRestoredAt(): mixed |
538
|
|
|
{ |
539
|
1 |
|
return $this->restoredAt; |
540
|
|
|
} |
541
|
|
|
|
542
|
|
|
/** |
543
|
|
|
* Sets the value of field restoredAt |
544
|
|
|
* Column: restored_at |
545
|
|
|
* Attributes: Type(4) |
546
|
|
|
* @param mixed $restoredAt |
547
|
|
|
* @return void |
548
|
|
|
*/ |
549
|
|
|
public function setRestoredAt(mixed $restoredAt): void |
550
|
|
|
{ |
551
|
|
|
$this->restoredAt = $restoredAt; |
552
|
|
|
} |
553
|
|
|
|
554
|
|
|
/** |
555
|
|
|
* Returns the value of field restoredBy |
556
|
|
|
* Column: restored_by |
557
|
|
|
* Attributes: Numeric | Unsigned |
558
|
|
|
* @return mixed |
559
|
|
|
*/ |
560
|
1 |
|
public function getRestoredBy(): mixed |
561
|
|
|
{ |
562
|
1 |
|
return $this->restoredBy; |
563
|
|
|
} |
564
|
|
|
|
565
|
|
|
/** |
566
|
|
|
* Sets the value of field restoredBy |
567
|
|
|
* Column: restored_by |
568
|
|
|
* Attributes: Numeric | Unsigned |
569
|
|
|
* @param mixed $restoredBy |
570
|
|
|
* @return void |
571
|
|
|
*/ |
572
|
|
|
public function setRestoredBy(mixed $restoredBy): void |
573
|
|
|
{ |
574
|
|
|
$this->restoredBy = $restoredBy; |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
/** |
578
|
|
|
* Returns the value of field restoredAs |
579
|
|
|
* Column: restored_as |
580
|
|
|
* Attributes: Numeric | Unsigned |
581
|
|
|
* @return mixed |
582
|
|
|
*/ |
583
|
1 |
|
public function getRestoredAs(): mixed |
584
|
|
|
{ |
585
|
1 |
|
return $this->restoredAs; |
586
|
|
|
} |
587
|
|
|
|
588
|
|
|
/** |
589
|
|
|
* Sets the value of field restoredAs |
590
|
|
|
* Column: restored_as |
591
|
|
|
* Attributes: Numeric | Unsigned |
592
|
|
|
* @param mixed $restoredAs |
593
|
|
|
* @return void |
594
|
|
|
*/ |
595
|
|
|
public function setRestoredAs(mixed $restoredAs): void |
596
|
|
|
{ |
597
|
|
|
$this->restoredAs = $restoredAs; |
598
|
|
|
} |
599
|
|
|
|
600
|
|
|
/** |
601
|
|
|
* Adds the default relationships to the model. |
602
|
|
|
* @return void |
603
|
|
|
*/ |
604
|
2 |
|
public function addDefaultRelationships(): void |
605
|
|
|
{ |
606
|
2 |
|
$this->hasMany('id', GroupRole::class, 'roleId', ['alias' => 'GroupRoleList']); |
607
|
|
|
|
608
|
2 |
|
$this->hasManyToMany( |
609
|
2 |
|
'id', |
610
|
2 |
|
GroupRole::class, |
611
|
2 |
|
'roleId', |
612
|
2 |
|
'groupId', |
613
|
2 |
|
Group::class, |
614
|
2 |
|
'id', |
615
|
2 |
|
['alias' => 'GroupList'] |
616
|
2 |
|
); |
617
|
|
|
|
618
|
2 |
|
$this->hasMany('id', RoleFeature::class, 'roleId', ['alias' => 'RoleFeatureList']); |
619
|
|
|
|
620
|
2 |
|
$this->hasManyToMany( |
621
|
2 |
|
'id', |
622
|
2 |
|
RoleFeature::class, |
623
|
2 |
|
'roleId', |
624
|
2 |
|
'featureId', |
625
|
2 |
|
Feature::class, |
626
|
2 |
|
'id', |
627
|
2 |
|
['alias' => 'FeatureList'] |
628
|
2 |
|
); |
629
|
|
|
|
630
|
2 |
|
$this->hasMany('id', UserRole::class, 'roleId', ['alias' => 'UserRoleList']); |
631
|
|
|
|
632
|
2 |
|
$this->hasManyToMany( |
633
|
2 |
|
'id', |
634
|
2 |
|
UserRole::class, |
635
|
2 |
|
'roleId', |
636
|
2 |
|
'userId', |
637
|
2 |
|
User::class, |
638
|
2 |
|
'id', |
639
|
2 |
|
['alias' => 'UserList'] |
640
|
2 |
|
); |
641
|
|
|
|
642
|
2 |
|
$this->belongsTo('createdBy', User::class, 'id', ['alias' => 'CreatedByEntity']); |
643
|
|
|
|
644
|
2 |
|
$this->belongsTo('createdAs', User::class, 'id', ['alias' => 'CreatedAsEntity']); |
645
|
|
|
|
646
|
2 |
|
$this->belongsTo('updatedBy', User::class, 'id', ['alias' => 'UpdatedByEntity']); |
647
|
|
|
|
648
|
2 |
|
$this->belongsTo('updatedAs', User::class, 'id', ['alias' => 'UpdatedAsEntity']); |
649
|
|
|
|
650
|
2 |
|
$this->belongsTo('deletedAs', User::class, 'id', ['alias' => 'DeletedAsEntity']); |
651
|
|
|
|
652
|
2 |
|
$this->belongsTo('deletedBy', User::class, 'id', ['alias' => 'DeletedByEntity']); |
653
|
|
|
|
654
|
2 |
|
$this->belongsTo('restoredBy', User::class, 'id', ['alias' => 'RestoredByEntity']); |
655
|
|
|
|
656
|
2 |
|
$this->belongsTo('restoredAs', User::class, 'id', ['alias' => 'RestoredAsEntity']); |
657
|
|
|
} |
658
|
|
|
|
659
|
|
|
/** |
660
|
|
|
* Adds the default validations to the model. |
661
|
|
|
* @param Validation|null $validator |
662
|
|
|
* @return Validation |
663
|
|
|
*/ |
664
|
1 |
|
public function addDefaultValidations(?Validation $validator = null): Validation |
665
|
|
|
{ |
666
|
1 |
|
$validator ??= new Validation(); |
667
|
|
|
|
668
|
1 |
|
$this->addUnsignedIntValidation($validator, 'id', true); |
669
|
1 |
|
$this->addStringLengthValidation($validator, 'index', 0, 50, false); |
670
|
1 |
|
$this->addStringLengthValidation($validator, 'label', 0, 100, false); |
671
|
1 |
|
$this->addUnsignedIntValidation($validator, 'position', false); |
672
|
1 |
|
$this->addUnsignedIntValidation($validator, 'deleted', false); |
673
|
1 |
|
$this->addDateTimeValidation($validator, 'createdAt', false); |
674
|
1 |
|
$this->addUnsignedIntValidation($validator, 'createdBy', true); |
675
|
1 |
|
$this->addUnsignedIntValidation($validator, 'createdAs', true); |
676
|
1 |
|
$this->addDateTimeValidation($validator, 'updatedAt', true); |
677
|
1 |
|
$this->addUnsignedIntValidation($validator, 'updatedBy', true); |
678
|
1 |
|
$this->addUnsignedIntValidation($validator, 'updatedAs', true); |
679
|
1 |
|
$this->addDateTimeValidation($validator, 'deletedAt', true); |
680
|
1 |
|
$this->addUnsignedIntValidation($validator, 'deletedAs', true); |
681
|
1 |
|
$this->addUnsignedIntValidation($validator, 'deletedBy', true); |
682
|
1 |
|
$this->addDateTimeValidation($validator, 'restoredAt', true); |
683
|
1 |
|
$this->addUnsignedIntValidation($validator, 'restoredBy', true); |
684
|
1 |
|
$this->addUnsignedIntValidation($validator, 'restoredAs', true); |
685
|
|
|
|
686
|
1 |
|
return $validator; |
687
|
|
|
} |
688
|
|
|
|
689
|
|
|
|
690
|
|
|
/** |
691
|
|
|
* Returns an array that maps the column names of the database |
692
|
|
|
* table to the corresponding property names of the model. |
693
|
|
|
* |
694
|
|
|
* @returns array The array mapping the column names to the property names |
695
|
|
|
*/ |
696
|
1 |
|
public function columnMap(): array |
697
|
|
|
{ |
698
|
1 |
|
return [ |
699
|
1 |
|
'id' => 'id', |
700
|
1 |
|
'index' => 'index', |
701
|
1 |
|
'label' => 'label', |
702
|
1 |
|
'position' => 'position', |
703
|
1 |
|
'deleted' => 'deleted', |
704
|
1 |
|
'created_at' => 'createdAt', |
705
|
1 |
|
'created_by' => 'createdBy', |
706
|
1 |
|
'created_as' => 'createdAs', |
707
|
1 |
|
'updated_at' => 'updatedAt', |
708
|
1 |
|
'updated_by' => 'updatedBy', |
709
|
1 |
|
'updated_as' => 'updatedAs', |
710
|
1 |
|
'deleted_at' => 'deletedAt', |
711
|
1 |
|
'deleted_as' => 'deletedAs', |
712
|
1 |
|
'deleted_by' => 'deletedBy', |
713
|
1 |
|
'restored_at' => 'restoredAt', |
714
|
1 |
|
'restored_by' => 'restoredBy', |
715
|
1 |
|
'restored_as' => 'restoredAs', |
716
|
1 |
|
]; |
717
|
|
|
} |
718
|
|
|
} |
719
|
|
|
|