Passed
Push — 1.0.x ( 8353d5...3a2c37 )
by Julien
21:28
created

PostAbstract::setContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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