FileAbstract::addDefaultValidations()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 26
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 30
ccs 0
cts 27
cp 0
crap 2
rs 9.504
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\EmailFile;
19
use Zemit\Models\Email;
20
use Zemit\Models\FileRelation;
21
use Zemit\Models\User;
22
use Zemit\Models\Abstracts\Interfaces\FileAbstractInterface;
23
24
/**
25
 * Class FileAbstract
26
 *
27
 * This class defines a File abstract model that extends the AbstractModel class and implements the FileAbstractInterface.
28
 * It provides properties and methods for managing File data.
29
 * 
30
 * @property EmailFile[] $emailfilelist
31
 * @property EmailFile[] $EmailFileList
32
 * @method EmailFile[] getEmailFileList(?array $params = null)
33
 *
34
 * @property Email[] $emaillist
35
 * @property Email[] $EmailList
36
 * @method Email[] getEmailList(?array $params = null)
37
 *
38
 * @property FileRelation[] $filerelationlist
39
 * @property FileRelation[] $FileRelationList
40
 * @method FileRelation[] getFileRelationList(?array $params = null)
41
 *
42
 * @property User $userentity
43
 * @property User $UserEntity
44
 * @method User getUserEntity(?array $params = null)
45
 *
46
 * @property User $createdbyentity
47
 * @property User $CreatedByEntity
48
 * @method User getCreatedByEntity(?array $params = null)
49
 *
50
 * @property User $createdasentity
51
 * @property User $CreatedAsEntity
52
 * @method User getCreatedAsEntity(?array $params = null)
53
 *
54
 * @property User $updatedbyentity
55
 * @property User $UpdatedByEntity
56
 * @method User getUpdatedByEntity(?array $params = null)
57
 *
58
 * @property User $updatedasentity
59
 * @property User $UpdatedAsEntity
60
 * @method User getUpdatedAsEntity(?array $params = null)
61
 *
62
 * @property User $deletedasentity
63
 * @property User $DeletedAsEntity
64
 * @method User getDeletedAsEntity(?array $params = null)
65
 *
66
 * @property User $deletedbyentity
67
 * @property User $DeletedByEntity
68
 * @method User getDeletedByEntity(?array $params = null)
69
 *
70
 * @property User $restoredbyentity
71
 * @property User $RestoredByEntity
72
 * @method User getRestoredByEntity(?array $params = null)
73
 *
74
 * @property User $restoredasentity
75
 * @property User $RestoredAsEntity
76
 * @method User getRestoredAsEntity(?array $params = null)
77
 */
78
abstract class FileAbstract extends AbstractModel implements FileAbstractInterface
79
{
80
    /**
81
     * Column: id
82
     * Attributes: First | Primary | NotNull | Numeric | Unsigned | AutoIncrement
83
     * @var mixed
84
     */
85
    public mixed $id = null;
86
        
87
    /**
88
     * Column: user_id
89
     * Attributes: Numeric | Unsigned
90
     * @var mixed
91
     */
92
    public mixed $userId = null;
93
        
94
    /**
95
     * Column: category
96
     * Attributes: NotNull | Size('partner','speaker','event','other') | Type(18)
97
     * @var mixed
98
     */
99
    public mixed $category = 'other';
100
        
101
    /**
102
     * Column: key
103
     * Attributes: Size(50) | Type(2)
104
     * @var mixed
105
     */
106
    public mixed $key = null;
107
        
108
    /**
109
     * Column: path
110
     * Attributes: Size(120) | Type(2)
111
     * @var mixed
112
     */
113
    public mixed $path = null;
114
        
115
    /**
116
     * Column: type
117
     * Attributes: Size(100) | Type(2)
118
     * @var mixed
119
     */
120
    public mixed $type = null;
121
        
122
    /**
123
     * Column: type_real
124
     * Attributes: Size(100) | Type(2)
125
     * @var mixed
126
     */
127
    public mixed $typeReal = null;
128
        
129
    /**
130
     * Column: extension
131
     * Attributes: Size(6) | Type(5)
132
     * @var mixed
133
     */
134
    public mixed $extension = null;
135
        
136
    /**
137
     * Column: name
138
     * Attributes: Size(100) | Type(2)
139
     * @var mixed
140
     */
141
    public mixed $name = null;
142
        
143
    /**
144
     * Column: name_temp
145
     * Attributes: Size(120) | Type(2)
146
     * @var mixed
147
     */
148
    public mixed $nameTemp = null;
149
        
150
    /**
151
     * Column: size
152
     * Attributes: Size(45) | Type(2)
153
     * @var mixed
154
     */
155
    public mixed $size = null;
156
        
157
    /**
158
     * Column: error
159
     * Attributes: Type(6)
160
     * @var mixed
161
     */
162
    public mixed $error = null;
163
        
164
    /**
165
     * Column: deleted
166
     * Attributes: NotNull | Numeric | Unsigned | Type(26)
167
     * @var mixed
168
     */
169
    public mixed $deleted = 0;
170
        
171
    /**
172
     * Column: created_at
173
     * Attributes: NotNull | Type(4)
174
     * @var mixed
175
     */
176
    public mixed $createdAt = null;
177
        
178
    /**
179
     * Column: created_by
180
     * Attributes: Numeric | Unsigned
181
     * @var mixed
182
     */
183
    public mixed $createdBy = null;
184
        
185
    /**
186
     * Column: created_as
187
     * Attributes: Numeric | Unsigned
188
     * @var mixed
189
     */
190
    public mixed $createdAs = null;
191
        
192
    /**
193
     * Column: updated_at
194
     * Attributes: Type(4)
195
     * @var mixed
196
     */
197
    public mixed $updatedAt = null;
198
        
199
    /**
200
     * Column: updated_by
201
     * Attributes: Numeric | Unsigned
202
     * @var mixed
203
     */
204
    public mixed $updatedBy = null;
205
        
206
    /**
207
     * Column: updated_as
208
     * Attributes: Numeric | Unsigned
209
     * @var mixed
210
     */
211
    public mixed $updatedAs = null;
212
        
213
    /**
214
     * Column: deleted_at
215
     * Attributes: Type(4)
216
     * @var mixed
217
     */
218
    public mixed $deletedAt = null;
219
        
220
    /**
221
     * Column: deleted_as
222
     * Attributes: Numeric | Unsigned
223
     * @var mixed
224
     */
225
    public mixed $deletedAs = null;
226
        
227
    /**
228
     * Column: deleted_by
229
     * Attributes: Numeric | Unsigned
230
     * @var mixed
231
     */
232
    public mixed $deletedBy = null;
233
        
234
    /**
235
     * Column: restored_at
236
     * Attributes: Type(4)
237
     * @var mixed
238
     */
239
    public mixed $restoredAt = null;
240
        
241
    /**
242
     * Column: restored_by
243
     * Attributes: Numeric | Unsigned
244
     * @var mixed
245
     */
246
    public mixed $restoredBy = null;
247
        
248
    /**
249
     * Column: restored_as
250
     * Attributes: Numeric | Unsigned
251
     * @var mixed
252
     */
253
    public mixed $restoredAs = null;
254
    
255
    /**
256
     * Returns the value of field id
257
     * Column: id
258
     * Attributes: First | Primary | NotNull | Numeric | Unsigned | AutoIncrement
259
     * @return mixed
260
     */
261 2
    public function getId(): mixed
262
    {
263 2
        return $this->id;
264
    }
265
    
266
    /**
267
     * Sets the value of field id
268
     * Column: id 
269
     * Attributes: First | Primary | NotNull | Numeric | Unsigned | AutoIncrement
270
     * @param mixed $id
271
     * @return void
272
     */
273 1
    public function setId(mixed $id): void
274
    {
275 1
        $this->id = $id;
276
    }
277
    
278
    /**
279
     * Returns the value of field userId
280
     * Column: user_id
281
     * Attributes: Numeric | Unsigned
282
     * @return mixed
283
     */
284 2
    public function getUserId(): mixed
285
    {
286 2
        return $this->userId;
287
    }
288
    
289
    /**
290
     * Sets the value of field userId
291
     * Column: user_id 
292
     * Attributes: Numeric | Unsigned
293
     * @param mixed $userId
294
     * @return void
295
     */
296 1
    public function setUserId(mixed $userId): void
297
    {
298 1
        $this->userId = $userId;
299
    }
300
    
301
    /**
302
     * Returns the value of field category
303
     * Column: category
304
     * Attributes: NotNull | Size('partner','speaker','event','other') | Type(18)
305
     * @return mixed
306
     */
307 2
    public function getCategory(): mixed
308
    {
309 2
        return $this->category;
310
    }
311
    
312
    /**
313
     * Sets the value of field category
314
     * Column: category 
315
     * Attributes: NotNull | Size('partner','speaker','event','other') | Type(18)
316
     * @param mixed $category
317
     * @return void
318
     */
319 1
    public function setCategory(mixed $category): void
320
    {
321 1
        $this->category = $category;
322
    }
323
    
324
    /**
325
     * Returns the value of field key
326
     * Column: key
327
     * Attributes: Size(50) | Type(2)
328
     * @return mixed
329
     */
330 2
    public function getKey(): mixed
331
    {
332 2
        return $this->key;
333
    }
334
    
335
    /**
336
     * Sets the value of field key
337
     * Column: key 
338
     * Attributes: Size(50) | Type(2)
339
     * @param mixed $key
340
     * @return void
341
     */
342 1
    public function setKey(mixed $key): void
343
    {
344 1
        $this->key = $key;
345
    }
346
    
347
    /**
348
     * Returns the value of field path
349
     * Column: path
350
     * Attributes: Size(120) | Type(2)
351
     * @return mixed
352
     */
353 2
    public function getPath(): mixed
354
    {
355 2
        return $this->path;
356
    }
357
    
358
    /**
359
     * Sets the value of field path
360
     * Column: path 
361
     * Attributes: Size(120) | Type(2)
362
     * @param mixed $path
363
     * @return void
364
     */
365 1
    public function setPath(mixed $path): void
366
    {
367 1
        $this->path = $path;
368
    }
369
    
370
    /**
371
     * Returns the value of field type
372
     * Column: type
373
     * Attributes: Size(100) | Type(2)
374
     * @return mixed
375
     */
376 2
    public function getType(): mixed
377
    {
378 2
        return $this->type;
379
    }
380
    
381
    /**
382
     * Sets the value of field type
383
     * Column: type 
384
     * Attributes: Size(100) | Type(2)
385
     * @param mixed $type
386
     * @return void
387
     */
388 1
    public function setType(mixed $type): void
389
    {
390 1
        $this->type = $type;
391
    }
392
    
393
    /**
394
     * Returns the value of field typeReal
395
     * Column: type_real
396
     * Attributes: Size(100) | Type(2)
397
     * @return mixed
398
     */
399 2
    public function getTypeReal(): mixed
400
    {
401 2
        return $this->typeReal;
402
    }
403
    
404
    /**
405
     * Sets the value of field typeReal
406
     * Column: type_real 
407
     * Attributes: Size(100) | Type(2)
408
     * @param mixed $typeReal
409
     * @return void
410
     */
411 1
    public function setTypeReal(mixed $typeReal): void
412
    {
413 1
        $this->typeReal = $typeReal;
414
    }
415
    
416
    /**
417
     * Returns the value of field extension
418
     * Column: extension
419
     * Attributes: Size(6) | Type(5)
420
     * @return mixed
421
     */
422 2
    public function getExtension(): mixed
423
    {
424 2
        return $this->extension;
425
    }
426
    
427
    /**
428
     * Sets the value of field extension
429
     * Column: extension 
430
     * Attributes: Size(6) | Type(5)
431
     * @param mixed $extension
432
     * @return void
433
     */
434 1
    public function setExtension(mixed $extension): void
435
    {
436 1
        $this->extension = $extension;
437
    }
438
    
439
    /**
440
     * Returns the value of field name
441
     * Column: name
442
     * Attributes: Size(100) | Type(2)
443
     * @return mixed
444
     */
445 2
    public function getName(): mixed
446
    {
447 2
        return $this->name;
448
    }
449
    
450
    /**
451
     * Sets the value of field name
452
     * Column: name 
453
     * Attributes: Size(100) | Type(2)
454
     * @param mixed $name
455
     * @return void
456
     */
457 1
    public function setName(mixed $name): void
458
    {
459 1
        $this->name = $name;
460
    }
461
    
462
    /**
463
     * Returns the value of field nameTemp
464
     * Column: name_temp
465
     * Attributes: Size(120) | Type(2)
466
     * @return mixed
467
     */
468 2
    public function getNameTemp(): mixed
469
    {
470 2
        return $this->nameTemp;
471
    }
472
    
473
    /**
474
     * Sets the value of field nameTemp
475
     * Column: name_temp 
476
     * Attributes: Size(120) | Type(2)
477
     * @param mixed $nameTemp
478
     * @return void
479
     */
480 1
    public function setNameTemp(mixed $nameTemp): void
481
    {
482 1
        $this->nameTemp = $nameTemp;
483
    }
484
    
485
    /**
486
     * Returns the value of field size
487
     * Column: size
488
     * Attributes: Size(45) | Type(2)
489
     * @return mixed
490
     */
491 2
    public function getSize(): mixed
492
    {
493 2
        return $this->size;
494
    }
495
    
496
    /**
497
     * Sets the value of field size
498
     * Column: size 
499
     * Attributes: Size(45) | Type(2)
500
     * @param mixed $size
501
     * @return void
502
     */
503 1
    public function setSize(mixed $size): void
504
    {
505 1
        $this->size = $size;
506
    }
507
    
508
    /**
509
     * Returns the value of field error
510
     * Column: error
511
     * Attributes: Type(6)
512
     * @return mixed
513
     */
514 2
    public function getError(): mixed
515
    {
516 2
        return $this->error;
517
    }
518
    
519
    /**
520
     * Sets the value of field error
521
     * Column: error 
522
     * Attributes: Type(6)
523
     * @param mixed $error
524
     * @return void
525
     */
526 1
    public function setError(mixed $error): void
527
    {
528 1
        $this->error = $error;
529
    }
530
    
531
    /**
532
     * Returns the value of field deleted
533
     * Column: deleted
534
     * Attributes: NotNull | Numeric | Unsigned | Type(26)
535
     * @return mixed
536
     */
537 2
    public function getDeleted(): mixed
538
    {
539 2
        return $this->deleted;
540
    }
541
    
542
    /**
543
     * Sets the value of field deleted
544
     * Column: deleted 
545
     * Attributes: NotNull | Numeric | Unsigned | Type(26)
546
     * @param mixed $deleted
547
     * @return void
548
     */
549 1
    public function setDeleted(mixed $deleted): void
550
    {
551 1
        $this->deleted = $deleted;
552
    }
553
    
554
    /**
555
     * Returns the value of field createdAt
556
     * Column: created_at
557
     * Attributes: NotNull | Type(4)
558
     * @return mixed
559
     */
560 2
    public function getCreatedAt(): mixed
561
    {
562 2
        return $this->createdAt;
563
    }
564
    
565
    /**
566
     * Sets the value of field createdAt
567
     * Column: created_at 
568
     * Attributes: NotNull | Type(4)
569
     * @param mixed $createdAt
570
     * @return void
571
     */
572 1
    public function setCreatedAt(mixed $createdAt): void
573
    {
574 1
        $this->createdAt = $createdAt;
575
    }
576
    
577
    /**
578
     * Returns the value of field createdBy
579
     * Column: created_by
580
     * Attributes: Numeric | Unsigned
581
     * @return mixed
582
     */
583 2
    public function getCreatedBy(): mixed
584
    {
585 2
        return $this->createdBy;
586
    }
587
    
588
    /**
589
     * Sets the value of field createdBy
590
     * Column: created_by 
591
     * Attributes: Numeric | Unsigned
592
     * @param mixed $createdBy
593
     * @return void
594
     */
595 1
    public function setCreatedBy(mixed $createdBy): void
596
    {
597 1
        $this->createdBy = $createdBy;
598
    }
599
    
600
    /**
601
     * Returns the value of field createdAs
602
     * Column: created_as
603
     * Attributes: Numeric | Unsigned
604
     * @return mixed
605
     */
606 2
    public function getCreatedAs(): mixed
607
    {
608 2
        return $this->createdAs;
609
    }
610
    
611
    /**
612
     * Sets the value of field createdAs
613
     * Column: created_as 
614
     * Attributes: Numeric | Unsigned
615
     * @param mixed $createdAs
616
     * @return void
617
     */
618 1
    public function setCreatedAs(mixed $createdAs): void
619
    {
620 1
        $this->createdAs = $createdAs;
621
    }
622
    
623
    /**
624
     * Returns the value of field updatedAt
625
     * Column: updated_at
626
     * Attributes: Type(4)
627
     * @return mixed
628
     */
629 2
    public function getUpdatedAt(): mixed
630
    {
631 2
        return $this->updatedAt;
632
    }
633
    
634
    /**
635
     * Sets the value of field updatedAt
636
     * Column: updated_at 
637
     * Attributes: Type(4)
638
     * @param mixed $updatedAt
639
     * @return void
640
     */
641 1
    public function setUpdatedAt(mixed $updatedAt): void
642
    {
643 1
        $this->updatedAt = $updatedAt;
644
    }
645
    
646
    /**
647
     * Returns the value of field updatedBy
648
     * Column: updated_by
649
     * Attributes: Numeric | Unsigned
650
     * @return mixed
651
     */
652 2
    public function getUpdatedBy(): mixed
653
    {
654 2
        return $this->updatedBy;
655
    }
656
    
657
    /**
658
     * Sets the value of field updatedBy
659
     * Column: updated_by 
660
     * Attributes: Numeric | Unsigned
661
     * @param mixed $updatedBy
662
     * @return void
663
     */
664 1
    public function setUpdatedBy(mixed $updatedBy): void
665
    {
666 1
        $this->updatedBy = $updatedBy;
667
    }
668
    
669
    /**
670
     * Returns the value of field updatedAs
671
     * Column: updated_as
672
     * Attributes: Numeric | Unsigned
673
     * @return mixed
674
     */
675 2
    public function getUpdatedAs(): mixed
676
    {
677 2
        return $this->updatedAs;
678
    }
679
    
680
    /**
681
     * Sets the value of field updatedAs
682
     * Column: updated_as 
683
     * Attributes: Numeric | Unsigned
684
     * @param mixed $updatedAs
685
     * @return void
686
     */
687 1
    public function setUpdatedAs(mixed $updatedAs): void
688
    {
689 1
        $this->updatedAs = $updatedAs;
690
    }
691
    
692
    /**
693
     * Returns the value of field deletedAt
694
     * Column: deleted_at
695
     * Attributes: Type(4)
696
     * @return mixed
697
     */
698 2
    public function getDeletedAt(): mixed
699
    {
700 2
        return $this->deletedAt;
701
    }
702
    
703
    /**
704
     * Sets the value of field deletedAt
705
     * Column: deleted_at 
706
     * Attributes: Type(4)
707
     * @param mixed $deletedAt
708
     * @return void
709
     */
710 1
    public function setDeletedAt(mixed $deletedAt): void
711
    {
712 1
        $this->deletedAt = $deletedAt;
713
    }
714
    
715
    /**
716
     * Returns the value of field deletedAs
717
     * Column: deleted_as
718
     * Attributes: Numeric | Unsigned
719
     * @return mixed
720
     */
721 2
    public function getDeletedAs(): mixed
722
    {
723 2
        return $this->deletedAs;
724
    }
725
    
726
    /**
727
     * Sets the value of field deletedAs
728
     * Column: deleted_as 
729
     * Attributes: Numeric | Unsigned
730
     * @param mixed $deletedAs
731
     * @return void
732
     */
733 1
    public function setDeletedAs(mixed $deletedAs): void
734
    {
735 1
        $this->deletedAs = $deletedAs;
736
    }
737
    
738
    /**
739
     * Returns the value of field deletedBy
740
     * Column: deleted_by
741
     * Attributes: Numeric | Unsigned
742
     * @return mixed
743
     */
744 2
    public function getDeletedBy(): mixed
745
    {
746 2
        return $this->deletedBy;
747
    }
748
    
749
    /**
750
     * Sets the value of field deletedBy
751
     * Column: deleted_by 
752
     * Attributes: Numeric | Unsigned
753
     * @param mixed $deletedBy
754
     * @return void
755
     */
756 1
    public function setDeletedBy(mixed $deletedBy): void
757
    {
758 1
        $this->deletedBy = $deletedBy;
759
    }
760
    
761
    /**
762
     * Returns the value of field restoredAt
763
     * Column: restored_at
764
     * Attributes: Type(4)
765
     * @return mixed
766
     */
767 2
    public function getRestoredAt(): mixed
768
    {
769 2
        return $this->restoredAt;
770
    }
771
    
772
    /**
773
     * Sets the value of field restoredAt
774
     * Column: restored_at 
775
     * Attributes: Type(4)
776
     * @param mixed $restoredAt
777
     * @return void
778
     */
779 1
    public function setRestoredAt(mixed $restoredAt): void
780
    {
781 1
        $this->restoredAt = $restoredAt;
782
    }
783
    
784
    /**
785
     * Returns the value of field restoredBy
786
     * Column: restored_by
787
     * Attributes: Numeric | Unsigned
788
     * @return mixed
789
     */
790 2
    public function getRestoredBy(): mixed
791
    {
792 2
        return $this->restoredBy;
793
    }
794
    
795
    /**
796
     * Sets the value of field restoredBy
797
     * Column: restored_by 
798
     * Attributes: Numeric | Unsigned
799
     * @param mixed $restoredBy
800
     * @return void
801
     */
802 1
    public function setRestoredBy(mixed $restoredBy): void
803
    {
804 1
        $this->restoredBy = $restoredBy;
805
    }
806
    
807
    /**
808
     * Returns the value of field restoredAs
809
     * Column: restored_as
810
     * Attributes: Numeric | Unsigned
811
     * @return mixed
812
     */
813 2
    public function getRestoredAs(): mixed
814
    {
815 2
        return $this->restoredAs;
816
    }
817
    
818
    /**
819
     * Sets the value of field restoredAs
820
     * Column: restored_as 
821
     * Attributes: Numeric | Unsigned
822
     * @param mixed $restoredAs
823
     * @return void
824
     */
825 1
    public function setRestoredAs(mixed $restoredAs): void
826
    {
827 1
        $this->restoredAs = $restoredAs;
828
    }
829
830
    /**
831
     * Adds the default relationships to the model.
832
     * @return void
833
     */
834 2
    public function addDefaultRelationships(): void
835
    {
836 2
        $this->hasMany('id', EmailFile::class, 'fileId', ['alias' => 'EmailFileList']);
837
838 2
        $this->hasManyToMany(
839 2
            'id',
840 2
            EmailFile::class,
841 2
            'fileId',
842 2
            'emailId',
843 2
            Email::class,
844 2
            'id',
845 2
            ['alias' => 'EmailList']
846 2
        );
847
848 2
        $this->hasMany('id', FileRelation::class, 'fileId', ['alias' => 'FileRelationList']);
849
850 2
        $this->belongsTo('userId', User::class, 'id', ['alias' => 'UserEntity']);
851
852 2
        $this->belongsTo('createdBy', User::class, 'id', ['alias' => 'CreatedByEntity']);
853
854 2
        $this->belongsTo('createdAs', User::class, 'id', ['alias' => 'CreatedAsEntity']);
855
856 2
        $this->belongsTo('updatedBy', User::class, 'id', ['alias' => 'UpdatedByEntity']);
857
858 2
        $this->belongsTo('updatedAs', User::class, 'id', ['alias' => 'UpdatedAsEntity']);
859
860 2
        $this->belongsTo('deletedAs', User::class, 'id', ['alias' => 'DeletedAsEntity']);
861
862 2
        $this->belongsTo('deletedBy', User::class, 'id', ['alias' => 'DeletedByEntity']);
863
864 2
        $this->belongsTo('restoredBy', User::class, 'id', ['alias' => 'RestoredByEntity']);
865
866 2
        $this->belongsTo('restoredAs', User::class, 'id', ['alias' => 'RestoredAsEntity']);
867
    }
868
    
869
    /**
870
     * Adds the default validations to the model.
871
     * @param Validation|null $validator
872
     * @return Validation
873
     */
874
    public function addDefaultValidations(?Validation $validator = null): Validation
875
    {
876
        $validator ??= new Validation();
877
    
878
        $this->addUnsignedIntValidation($validator, 'id', true);
879
        $this->addUnsignedIntValidation($validator, 'userId', true);
880
        $this->addInclusionInValidation($validator, 'category', ['partner','speaker','event','other'], false);
881
        $this->addStringLengthValidation($validator, 'key', 0, 50, true);
882
        $this->addStringLengthValidation($validator, 'path', 0, 120, true);
883
        $this->addStringLengthValidation($validator, 'type', 0, 100, true);
884
        $this->addStringLengthValidation($validator, 'typeReal', 0, 100, true);
885
        $this->addStringLengthValidation($validator, 'extension', 0, 6, true);
886
        $this->addStringLengthValidation($validator, 'name', 0, 100, true);
887
        $this->addStringLengthValidation($validator, 'nameTemp', 0, 120, true);
888
        $this->addStringLengthValidation($validator, 'size', 0, 45, true);
889
        $this->addUnsignedIntValidation($validator, 'deleted', false);
890
        $this->addDateTimeValidation($validator, 'createdAt', false);
891
        $this->addUnsignedIntValidation($validator, 'createdBy', true);
892
        $this->addUnsignedIntValidation($validator, 'createdAs', true);
893
        $this->addDateTimeValidation($validator, 'updatedAt', true);
894
        $this->addUnsignedIntValidation($validator, 'updatedBy', true);
895
        $this->addUnsignedIntValidation($validator, 'updatedAs', true);
896
        $this->addDateTimeValidation($validator, 'deletedAt', true);
897
        $this->addUnsignedIntValidation($validator, 'deletedAs', true);
898
        $this->addUnsignedIntValidation($validator, 'deletedBy', true);
899
        $this->addDateTimeValidation($validator, 'restoredAt', true);
900
        $this->addUnsignedIntValidation($validator, 'restoredBy', true);
901
        $this->addUnsignedIntValidation($validator, 'restoredAs', true);
902
        
903
        return $validator;
904
    }
905
906
        
907
    /**
908
     * Returns an array that maps the column names of the database
909
     * table to the corresponding property names of the model.
910
     * 
911
     * @returns array The array mapping the column names to the property names
912
     */
913 1
    public function columnMap(): array
914
    {
915 1
        return [
916 1
            'id' => 'id',
917 1
            'user_id' => 'userId',
918 1
            'category' => 'category',
919 1
            'key' => 'key',
920 1
            'path' => 'path',
921 1
            'type' => 'type',
922 1
            'type_real' => 'typeReal',
923 1
            'extension' => 'extension',
924 1
            'name' => 'name',
925 1
            'name_temp' => 'nameTemp',
926 1
            'size' => 'size',
927 1
            'error' => 'error',
928 1
            'deleted' => 'deleted',
929 1
            'created_at' => 'createdAt',
930 1
            'created_by' => 'createdBy',
931 1
            'created_as' => 'createdAs',
932 1
            'updated_at' => 'updatedAt',
933 1
            'updated_by' => 'updatedBy',
934 1
            'updated_as' => 'updatedAs',
935 1
            'deleted_at' => 'deletedAt',
936 1
            'deleted_as' => 'deletedAs',
937 1
            'deleted_by' => 'deletedBy',
938 1
            'restored_at' => 'restoredAt',
939 1
            'restored_by' => 'restoredBy',
940 1
            'restored_as' => 'restoredAs',
941 1
        ];
942
    }
943
}
944