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