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

SiteAbstract::setUuid()   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\Category;
19
use Zemit\Models\Lang;
20
use Zemit\Models\Data;
21
use Zemit\Models\Table;
22
use Zemit\Models\Field;
23
use Zemit\Models\Flag;
24
use Zemit\Models\Page;
25
use Zemit\Models\Meta;
26
use Zemit\Models\Post;
27
use Zemit\Models\SiteLang;
28
use Zemit\Models\Translate;
29
use Zemit\Models\TranslateField;
30
use Zemit\Models\User;
31
use Zemit\Models\Abstracts\Interfaces\SiteAbstractInterface;
32
33
/**
34
 * Class SiteAbstract
35
 *
36
 * This class defines a Site abstract model that extends the AbstractModel class and implements the SiteAbstractInterface.
37
 * It provides properties and methods for managing Site data.
38
 * 
39
 * @property Category[] $categorylist
40
 * @property Category[] $CategoryList
41
 * @method Category[] getCategoryList(?array $params = null)
42
 *
43
 * @property Lang[] $categorylanglist
44
 * @property Lang[] $CategoryLangList
45
 * @method Lang[] getCategoryLangList(?array $params = null)
46
 *
47
 * @property Data[] $datalist
48
 * @property Data[] $DataList
49
 * @method Data[] getDataList(?array $params = null)
50
 *
51
 * @property Table[] $datatablelist
52
 * @property Table[] $DataTableList
53
 * @method Table[] getDataTableList(?array $params = null)
54
 *
55
 * @property Field[] $datafieldlist
56
 * @property Field[] $DataFieldList
57
 * @method Field[] getDataFieldList(?array $params = null)
58
 *
59
 * @property Field[] $fieldlist
60
 * @property Field[] $FieldList
61
 * @method Field[] getFieldList(?array $params = null)
62
 *
63
 * @property Table[] $fieldtablelist
64
 * @property Table[] $FieldTableList
65
 * @method Table[] getFieldTableList(?array $params = null)
66
 *
67
 * @property Flag[] $flaglist
68
 * @property Flag[] $FlagList
69
 * @method Flag[] getFlagList(?array $params = null)
70
 *
71
 * @property Page[] $flagpagelist
72
 * @property Page[] $FlagPageList
73
 * @method Page[] getFlagPageList(?array $params = null)
74
 *
75
 * @property Lang[] $flaglanglist
76
 * @property Lang[] $FlagLangList
77
 * @method Lang[] getFlagLangList(?array $params = null)
78
 *
79
 * @property Meta[] $metalist
80
 * @property Meta[] $MetaList
81
 * @method Meta[] getMetaList(?array $params = null)
82
 *
83
 * @property Lang[] $metalanglist
84
 * @property Lang[] $MetaLangList
85
 * @method Lang[] getMetaLangList(?array $params = null)
86
 *
87
 * @property Page[] $metapagelist
88
 * @property Page[] $MetaPageList
89
 * @method Page[] getMetaPageList(?array $params = null)
90
 *
91
 * @property Post[] $metapostlist
92
 * @property Post[] $MetaPostList
93
 * @method Post[] getMetaPostList(?array $params = null)
94
 *
95
 * @property Category[] $metacategorylist
96
 * @property Category[] $MetaCategoryList
97
 * @method Category[] getMetaCategoryList(?array $params = null)
98
 *
99
 * @property Page[] $pagelist
100
 * @property Page[] $PageList
101
 * @method Page[] getPageList(?array $params = null)
102
 *
103
 * @property Lang[] $pagelanglist
104
 * @property Lang[] $PageLangList
105
 * @method Lang[] getPageLangList(?array $params = null)
106
 *
107
 * @property Post[] $postlist
108
 * @property Post[] $PostList
109
 * @method Post[] getPostList(?array $params = null)
110
 *
111
 * @property Lang[] $postlanglist
112
 * @property Lang[] $PostLangList
113
 * @method Lang[] getPostLangList(?array $params = null)
114
 *
115
 * @property Page[] $postpagelist
116
 * @property Page[] $PostPageList
117
 * @method Page[] getPostPageList(?array $params = null)
118
 *
119
 * @property SiteLang[] $sitelanglist
120
 * @property SiteLang[] $SiteLangList
121
 * @method SiteLang[] getSiteLangList(?array $params = null)
122
 *
123
 * @property Lang[] $langlist
124
 * @property Lang[] $LangList
125
 * @method Lang[] getLangList(?array $params = null)
126
 *
127
 * @property Translate[] $translatelist
128
 * @property Translate[] $TranslateList
129
 * @method Translate[] getTranslateList(?array $params = null)
130
 *
131
 * @property Lang[] $translatelanglist
132
 * @property Lang[] $TranslateLangList
133
 * @method Lang[] getTranslateLangList(?array $params = null)
134
 *
135
 * @property Page[] $translatepagelist
136
 * @property Page[] $TranslatePageList
137
 * @method Page[] getTranslatePageList(?array $params = null)
138
 *
139
 * @property Post[] $translatepostlist
140
 * @property Post[] $TranslatePostList
141
 * @method Post[] getTranslatePostList(?array $params = null)
142
 *
143
 * @property Category[] $translatecategorylist
144
 * @property Category[] $TranslateCategoryList
145
 * @method Category[] getTranslateCategoryList(?array $params = null)
146
 *
147
 * @property TranslateField[] $translatefieldlist
148
 * @property TranslateField[] $TranslateFieldList
149
 * @method TranslateField[] getTranslateFieldList(?array $params = null)
150
 *
151
 * @property Lang[] $translatefieldlanglist
152
 * @property Lang[] $TranslateFieldLangList
153
 * @method Lang[] getTranslateFieldLangList(?array $params = null)
154
 *
155
 * @property Table[] $translatefieldtablelist
156
 * @property Table[] $TranslateFieldTableList
157
 * @method Table[] getTranslateFieldTableList(?array $params = null)
158
 *
159
 * @property User $createdbyentity
160
 * @property User $CreatedByEntity
161
 * @method User getCreatedByEntity(?array $params = null)
162
 *
163
 * @property User $createdasentity
164
 * @property User $CreatedAsEntity
165
 * @method User getCreatedAsEntity(?array $params = null)
166
 *
167
 * @property User $updatedbyentity
168
 * @property User $UpdatedByEntity
169
 * @method User getUpdatedByEntity(?array $params = null)
170
 *
171
 * @property User $updatedasentity
172
 * @property User $UpdatedAsEntity
173
 * @method User getUpdatedAsEntity(?array $params = null)
174
 *
175
 * @property User $deletedasentity
176
 * @property User $DeletedAsEntity
177
 * @method User getDeletedAsEntity(?array $params = null)
178
 *
179
 * @property User $deletedbyentity
180
 * @property User $DeletedByEntity
181
 * @method User getDeletedByEntity(?array $params = null)
182
 *
183
 * @property User $restoredbyentity
184
 * @property User $RestoredByEntity
185
 * @method User getRestoredByEntity(?array $params = null)
186
 *
187
 * @property User $restoredasentity
188
 * @property User $RestoredAsEntity
189
 * @method User getRestoredAsEntity(?array $params = null)
190
 */
191
abstract class SiteAbstract extends AbstractModel implements SiteAbstractInterface
192
{
193
    /**
194
     * Column: id
195
     * Attributes: First | Primary | NotNull | Numeric | Unsigned | AutoIncrement
196
     * @var mixed
197
     */
198
    public mixed $id = null;
199
        
200
    /**
201
     * Column: uuid
202
     * Attributes: NotNull | Size(36) | Type(5)
203
     * @var mixed
204
     */
205
    public mixed $uuid = null;
206
        
207
    /**
208
     * Column: name
209
     * Attributes: NotNull | Size(60) | Type(2)
210
     * @var mixed
211
     */
212
    public mixed $name = null;
213
        
214
    /**
215
     * Column: description
216
     * Attributes: Size(240) | Type(2)
217
     * @var mixed
218
     */
219
    public mixed $description = null;
220
        
221
    /**
222
     * Column: icon
223
     * Attributes: Size(64) | Type(2)
224
     * @var mixed
225
     */
226
    public mixed $icon = null;
227
        
228
    /**
229
     * Column: color
230
     * Attributes: Size(9) | Type(5)
231
     * @var mixed
232
     */
233
    public mixed $color = null;
234
        
235
    /**
236
     * Column: status
237
     * Attributes: NotNull | Size('active','inactive') | Type(18)
238
     * @var mixed
239
     */
240
    public mixed $status = 'active';
241
        
242
    /**
243
     * Column: deleted
244
     * Attributes: NotNull | Numeric | Unsigned | Type(26)
245
     * @var mixed
246
     */
247
    public mixed $deleted = 0;
248
        
249
    /**
250
     * Column: created_at
251
     * Attributes: NotNull | Type(4)
252
     * @var mixed
253
     */
254
    public mixed $createdAt = null;
255
        
256
    /**
257
     * Column: created_by
258
     * Attributes: Numeric | Unsigned
259
     * @var mixed
260
     */
261
    public mixed $createdBy = null;
262
        
263
    /**
264
     * Column: created_as
265
     * Attributes: Numeric | Unsigned
266
     * @var mixed
267
     */
268
    public mixed $createdAs = null;
269
        
270
    /**
271
     * Column: updated_at
272
     * Attributes: Type(4)
273
     * @var mixed
274
     */
275
    public mixed $updatedAt = null;
276
        
277
    /**
278
     * Column: updated_by
279
     * Attributes: Numeric | Unsigned
280
     * @var mixed
281
     */
282
    public mixed $updatedBy = null;
283
        
284
    /**
285
     * Column: updated_as
286
     * Attributes: Numeric | Unsigned
287
     * @var mixed
288
     */
289
    public mixed $updatedAs = null;
290
        
291
    /**
292
     * Column: deleted_at
293
     * Attributes: Type(4)
294
     * @var mixed
295
     */
296
    public mixed $deletedAt = null;
297
        
298
    /**
299
     * Column: deleted_as
300
     * Attributes: Numeric | Unsigned
301
     * @var mixed
302
     */
303
    public mixed $deletedAs = null;
304
        
305
    /**
306
     * Column: deleted_by
307
     * Attributes: Numeric | Unsigned
308
     * @var mixed
309
     */
310
    public mixed $deletedBy = null;
311
        
312
    /**
313
     * Column: restored_at
314
     * Attributes: Type(4)
315
     * @var mixed
316
     */
317
    public mixed $restoredAt = null;
318
        
319
    /**
320
     * Column: restored_by
321
     * Attributes: Numeric | Unsigned
322
     * @var mixed
323
     */
324
    public mixed $restoredBy = null;
325
        
326
    /**
327
     * Column: restored_as
328
     * Attributes: Numeric | Unsigned
329
     * @var mixed
330
     */
331
    public mixed $restoredAs = null;
332
    
333
    /**
334
     * Returns the value of field id
335
     * Column: id
336
     * Attributes: First | Primary | NotNull | Numeric | Unsigned | AutoIncrement
337
     * @return mixed
338
     */
339
    public function getId(): mixed
340
    {
341
        return $this->id;
342
    }
343
    
344
    /**
345
     * Sets the value of field id
346
     * Column: id 
347
     * Attributes: First | Primary | NotNull | Numeric | Unsigned | AutoIncrement
348
     * @param mixed $id
349
     * @return void
350
     */
351
    public function setId(mixed $id): void
352
    {
353
        $this->id = $id;
354
    }
355
    
356
    /**
357
     * Returns the value of field uuid
358
     * Column: uuid
359
     * Attributes: NotNull | Size(36) | Type(5)
360
     * @return mixed
361
     */
362
    public function getUuid(): mixed
363
    {
364
        return $this->uuid;
365
    }
366
    
367
    /**
368
     * Sets the value of field uuid
369
     * Column: uuid 
370
     * Attributes: NotNull | Size(36) | Type(5)
371
     * @param mixed $uuid
372
     * @return void
373
     */
374
    public function setUuid(mixed $uuid): void
375
    {
376
        $this->uuid = $uuid;
377
    }
378
    
379
    /**
380
     * Returns the value of field name
381
     * Column: name
382
     * Attributes: NotNull | Size(60) | Type(2)
383
     * @return mixed
384
     */
385
    public function getName(): mixed
386
    {
387
        return $this->name;
388
    }
389
    
390
    /**
391
     * Sets the value of field name
392
     * Column: name 
393
     * Attributes: NotNull | Size(60) | Type(2)
394
     * @param mixed $name
395
     * @return void
396
     */
397
    public function setName(mixed $name): void
398
    {
399
        $this->name = $name;
400
    }
401
    
402
    /**
403
     * Returns the value of field description
404
     * Column: description
405
     * Attributes: Size(240) | Type(2)
406
     * @return mixed
407
     */
408
    public function getDescription(): mixed
409
    {
410
        return $this->description;
411
    }
412
    
413
    /**
414
     * Sets the value of field description
415
     * Column: description 
416
     * Attributes: Size(240) | Type(2)
417
     * @param mixed $description
418
     * @return void
419
     */
420
    public function setDescription(mixed $description): void
421
    {
422
        $this->description = $description;
423
    }
424
    
425
    /**
426
     * Returns the value of field icon
427
     * Column: icon
428
     * Attributes: Size(64) | Type(2)
429
     * @return mixed
430
     */
431
    public function getIcon(): mixed
432
    {
433
        return $this->icon;
434
    }
435
    
436
    /**
437
     * Sets the value of field icon
438
     * Column: icon 
439
     * Attributes: Size(64) | Type(2)
440
     * @param mixed $icon
441
     * @return void
442
     */
443
    public function setIcon(mixed $icon): void
444
    {
445
        $this->icon = $icon;
446
    }
447
    
448
    /**
449
     * Returns the value of field color
450
     * Column: color
451
     * Attributes: Size(9) | Type(5)
452
     * @return mixed
453
     */
454
    public function getColor(): mixed
455
    {
456
        return $this->color;
457
    }
458
    
459
    /**
460
     * Sets the value of field color
461
     * Column: color 
462
     * Attributes: Size(9) | Type(5)
463
     * @param mixed $color
464
     * @return void
465
     */
466
    public function setColor(mixed $color): void
467
    {
468
        $this->color = $color;
469
    }
470
    
471
    /**
472
     * Returns the value of field status
473
     * Column: status
474
     * Attributes: NotNull | Size('active','inactive') | Type(18)
475
     * @return mixed
476
     */
477
    public function getStatus(): mixed
478
    {
479
        return $this->status;
480
    }
481
    
482
    /**
483
     * Sets the value of field status
484
     * Column: status 
485
     * Attributes: NotNull | Size('active','inactive') | Type(18)
486
     * @param mixed $status
487
     * @return void
488
     */
489
    public function setStatus(mixed $status): void
490
    {
491
        $this->status = $status;
492
    }
493
    
494
    /**
495
     * Returns the value of field deleted
496
     * Column: deleted
497
     * Attributes: NotNull | Numeric | Unsigned | Type(26)
498
     * @return mixed
499
     */
500
    public function getDeleted(): mixed
501
    {
502
        return $this->deleted;
503
    }
504
    
505
    /**
506
     * Sets the value of field deleted
507
     * Column: deleted 
508
     * Attributes: NotNull | Numeric | Unsigned | Type(26)
509
     * @param mixed $deleted
510
     * @return void
511
     */
512
    public function setDeleted(mixed $deleted): void
513
    {
514
        $this->deleted = $deleted;
515
    }
516
    
517
    /**
518
     * Returns the value of field createdAt
519
     * Column: created_at
520
     * Attributes: NotNull | Type(4)
521
     * @return mixed
522
     */
523
    public function getCreatedAt(): mixed
524
    {
525
        return $this->createdAt;
526
    }
527
    
528
    /**
529
     * Sets the value of field createdAt
530
     * Column: created_at 
531
     * Attributes: NotNull | Type(4)
532
     * @param mixed $createdAt
533
     * @return void
534
     */
535
    public function setCreatedAt(mixed $createdAt): void
536
    {
537
        $this->createdAt = $createdAt;
538
    }
539
    
540
    /**
541
     * Returns the value of field createdBy
542
     * Column: created_by
543
     * Attributes: Numeric | Unsigned
544
     * @return mixed
545
     */
546
    public function getCreatedBy(): mixed
547
    {
548
        return $this->createdBy;
549
    }
550
    
551
    /**
552
     * Sets the value of field createdBy
553
     * Column: created_by 
554
     * Attributes: Numeric | Unsigned
555
     * @param mixed $createdBy
556
     * @return void
557
     */
558
    public function setCreatedBy(mixed $createdBy): void
559
    {
560
        $this->createdBy = $createdBy;
561
    }
562
    
563
    /**
564
     * Returns the value of field createdAs
565
     * Column: created_as
566
     * Attributes: Numeric | Unsigned
567
     * @return mixed
568
     */
569
    public function getCreatedAs(): mixed
570
    {
571
        return $this->createdAs;
572
    }
573
    
574
    /**
575
     * Sets the value of field createdAs
576
     * Column: created_as 
577
     * Attributes: Numeric | Unsigned
578
     * @param mixed $createdAs
579
     * @return void
580
     */
581
    public function setCreatedAs(mixed $createdAs): void
582
    {
583
        $this->createdAs = $createdAs;
584
    }
585
    
586
    /**
587
     * Returns the value of field updatedAt
588
     * Column: updated_at
589
     * Attributes: Type(4)
590
     * @return mixed
591
     */
592
    public function getUpdatedAt(): mixed
593
    {
594
        return $this->updatedAt;
595
    }
596
    
597
    /**
598
     * Sets the value of field updatedAt
599
     * Column: updated_at 
600
     * Attributes: Type(4)
601
     * @param mixed $updatedAt
602
     * @return void
603
     */
604
    public function setUpdatedAt(mixed $updatedAt): void
605
    {
606
        $this->updatedAt = $updatedAt;
607
    }
608
    
609
    /**
610
     * Returns the value of field updatedBy
611
     * Column: updated_by
612
     * Attributes: Numeric | Unsigned
613
     * @return mixed
614
     */
615
    public function getUpdatedBy(): mixed
616
    {
617
        return $this->updatedBy;
618
    }
619
    
620
    /**
621
     * Sets the value of field updatedBy
622
     * Column: updated_by 
623
     * Attributes: Numeric | Unsigned
624
     * @param mixed $updatedBy
625
     * @return void
626
     */
627
    public function setUpdatedBy(mixed $updatedBy): void
628
    {
629
        $this->updatedBy = $updatedBy;
630
    }
631
    
632
    /**
633
     * Returns the value of field updatedAs
634
     * Column: updated_as
635
     * Attributes: Numeric | Unsigned
636
     * @return mixed
637
     */
638
    public function getUpdatedAs(): mixed
639
    {
640
        return $this->updatedAs;
641
    }
642
    
643
    /**
644
     * Sets the value of field updatedAs
645
     * Column: updated_as 
646
     * Attributes: Numeric | Unsigned
647
     * @param mixed $updatedAs
648
     * @return void
649
     */
650
    public function setUpdatedAs(mixed $updatedAs): void
651
    {
652
        $this->updatedAs = $updatedAs;
653
    }
654
    
655
    /**
656
     * Returns the value of field deletedAt
657
     * Column: deleted_at
658
     * Attributes: Type(4)
659
     * @return mixed
660
     */
661
    public function getDeletedAt(): mixed
662
    {
663
        return $this->deletedAt;
664
    }
665
    
666
    /**
667
     * Sets the value of field deletedAt
668
     * Column: deleted_at 
669
     * Attributes: Type(4)
670
     * @param mixed $deletedAt
671
     * @return void
672
     */
673
    public function setDeletedAt(mixed $deletedAt): void
674
    {
675
        $this->deletedAt = $deletedAt;
676
    }
677
    
678
    /**
679
     * Returns the value of field deletedAs
680
     * Column: deleted_as
681
     * Attributes: Numeric | Unsigned
682
     * @return mixed
683
     */
684
    public function getDeletedAs(): mixed
685
    {
686
        return $this->deletedAs;
687
    }
688
    
689
    /**
690
     * Sets the value of field deletedAs
691
     * Column: deleted_as 
692
     * Attributes: Numeric | Unsigned
693
     * @param mixed $deletedAs
694
     * @return void
695
     */
696
    public function setDeletedAs(mixed $deletedAs): void
697
    {
698
        $this->deletedAs = $deletedAs;
699
    }
700
    
701
    /**
702
     * Returns the value of field deletedBy
703
     * Column: deleted_by
704
     * Attributes: Numeric | Unsigned
705
     * @return mixed
706
     */
707
    public function getDeletedBy(): mixed
708
    {
709
        return $this->deletedBy;
710
    }
711
    
712
    /**
713
     * Sets the value of field deletedBy
714
     * Column: deleted_by 
715
     * Attributes: Numeric | Unsigned
716
     * @param mixed $deletedBy
717
     * @return void
718
     */
719
    public function setDeletedBy(mixed $deletedBy): void
720
    {
721
        $this->deletedBy = $deletedBy;
722
    }
723
    
724
    /**
725
     * Returns the value of field restoredAt
726
     * Column: restored_at
727
     * Attributes: Type(4)
728
     * @return mixed
729
     */
730
    public function getRestoredAt(): mixed
731
    {
732
        return $this->restoredAt;
733
    }
734
    
735
    /**
736
     * Sets the value of field restoredAt
737
     * Column: restored_at 
738
     * Attributes: Type(4)
739
     * @param mixed $restoredAt
740
     * @return void
741
     */
742
    public function setRestoredAt(mixed $restoredAt): void
743
    {
744
        $this->restoredAt = $restoredAt;
745
    }
746
    
747
    /**
748
     * Returns the value of field restoredBy
749
     * Column: restored_by
750
     * Attributes: Numeric | Unsigned
751
     * @return mixed
752
     */
753
    public function getRestoredBy(): mixed
754
    {
755
        return $this->restoredBy;
756
    }
757
    
758
    /**
759
     * Sets the value of field restoredBy
760
     * Column: restored_by 
761
     * Attributes: Numeric | Unsigned
762
     * @param mixed $restoredBy
763
     * @return void
764
     */
765
    public function setRestoredBy(mixed $restoredBy): void
766
    {
767
        $this->restoredBy = $restoredBy;
768
    }
769
    
770
    /**
771
     * Returns the value of field restoredAs
772
     * Column: restored_as
773
     * Attributes: Numeric | Unsigned
774
     * @return mixed
775
     */
776
    public function getRestoredAs(): mixed
777
    {
778
        return $this->restoredAs;
779
    }
780
    
781
    /**
782
     * Sets the value of field restoredAs
783
     * Column: restored_as 
784
     * Attributes: Numeric | Unsigned
785
     * @param mixed $restoredAs
786
     * @return void
787
     */
788
    public function setRestoredAs(mixed $restoredAs): void
789
    {
790
        $this->restoredAs = $restoredAs;
791
    }
792
793
    /**
794
     * Adds the default relationships to the model.
795
     * @return void
796
     */
797
    public function addDefaultRelationships(): void
798
    {
799
        $this->hasMany('id', Category::class, 'siteId', ['alias' => 'CategoryList']);
800
801
        $this->hasManyToMany(
802
            'id',
803
            Category::class,
804
            'siteId',
805
            'langId',
806
            Lang::class,
807
            'id',
808
            ['alias' => 'CategoryLangList']
809
        );
810
811
        $this->hasMany('id', Data::class, 'siteId', ['alias' => 'DataList']);
812
813
        $this->hasManyToMany(
814
            'id',
815
            Data::class,
816
            'siteId',
817
            'tableId',
818
            Table::class,
819
            'id',
820
            ['alias' => 'DataTableList']
821
        );
822
823
        $this->hasManyToMany(
824
            'id',
825
            Data::class,
826
            'siteId',
827
            'fieldId',
828
            Field::class,
829
            'id',
830
            ['alias' => 'DataFieldList']
831
        );
832
833
        $this->hasMany('id', Field::class, 'siteId', ['alias' => 'FieldList']);
834
835
        $this->hasManyToMany(
836
            'id',
837
            Field::class,
838
            'siteId',
839
            'tableId',
840
            Table::class,
841
            'id',
842
            ['alias' => 'FieldTableList']
843
        );
844
845
        $this->hasMany('id', Flag::class, 'siteId', ['alias' => 'FlagList']);
846
847
        $this->hasManyToMany(
848
            'id',
849
            Flag::class,
850
            'siteId',
851
            'pageId',
852
            Page::class,
853
            'id',
854
            ['alias' => 'FlagPageList']
855
        );
856
857
        $this->hasManyToMany(
858
            'id',
859
            Flag::class,
860
            'siteId',
861
            'langId',
862
            Lang::class,
863
            'id',
864
            ['alias' => 'FlagLangList']
865
        );
866
867
        $this->hasMany('id', Meta::class, 'siteId', ['alias' => 'MetaList']);
868
869
        $this->hasManyToMany(
870
            'id',
871
            Meta::class,
872
            'siteId',
873
            'langId',
874
            Lang::class,
875
            'id',
876
            ['alias' => 'MetaLangList']
877
        );
878
879
        $this->hasManyToMany(
880
            'id',
881
            Meta::class,
882
            'siteId',
883
            'pageId',
884
            Page::class,
885
            'id',
886
            ['alias' => 'MetaPageList']
887
        );
888
889
        $this->hasManyToMany(
890
            'id',
891
            Meta::class,
892
            'siteId',
893
            'postId',
894
            Post::class,
895
            'id',
896
            ['alias' => 'MetaPostList']
897
        );
898
899
        $this->hasManyToMany(
900
            'id',
901
            Meta::class,
902
            'siteId',
903
            'categoryId',
904
            Category::class,
905
            'id',
906
            ['alias' => 'MetaCategoryList']
907
        );
908
909
        $this->hasMany('id', Page::class, 'siteId', ['alias' => 'PageList']);
910
911
        $this->hasManyToMany(
912
            'id',
913
            Page::class,
914
            'siteId',
915
            'langId',
916
            Lang::class,
917
            'id',
918
            ['alias' => 'PageLangList']
919
        );
920
921
        $this->hasMany('id', Post::class, 'siteId', ['alias' => 'PostList']);
922
923
        $this->hasManyToMany(
924
            'id',
925
            Post::class,
926
            'siteId',
927
            'langId',
928
            Lang::class,
929
            'id',
930
            ['alias' => 'PostLangList']
931
        );
932
933
        $this->hasManyToMany(
934
            'id',
935
            Post::class,
936
            'siteId',
937
            'pageId',
938
            Page::class,
939
            'id',
940
            ['alias' => 'PostPageList']
941
        );
942
943
        $this->hasMany('id', SiteLang::class, 'siteId', ['alias' => 'SiteLangList']);
944
945
        $this->hasManyToMany(
946
            'id',
947
            SiteLang::class,
948
            'siteId',
949
            'langId',
950
            Lang::class,
951
            'id',
952
            ['alias' => 'LangList']
953
        );
954
955
        $this->hasMany('id', Translate::class, 'siteId', ['alias' => 'TranslateList']);
956
957
        $this->hasManyToMany(
958
            'id',
959
            Translate::class,
960
            'siteId',
961
            'langId',
962
            Lang::class,
963
            'id',
964
            ['alias' => 'TranslateLangList']
965
        );
966
967
        $this->hasManyToMany(
968
            'id',
969
            Translate::class,
970
            'siteId',
971
            'pageId',
972
            Page::class,
973
            'id',
974
            ['alias' => 'TranslatePageList']
975
        );
976
977
        $this->hasManyToMany(
978
            'id',
979
            Translate::class,
980
            'siteId',
981
            'postId',
982
            Post::class,
983
            'id',
984
            ['alias' => 'TranslatePostList']
985
        );
986
987
        $this->hasManyToMany(
988
            'id',
989
            Translate::class,
990
            'siteId',
991
            'categoryId',
992
            Category::class,
993
            'id',
994
            ['alias' => 'TranslateCategoryList']
995
        );
996
997
        $this->hasMany('id', TranslateField::class, 'siteId', ['alias' => 'TranslateFieldList']);
998
999
        $this->hasManyToMany(
1000
            'id',
1001
            TranslateField::class,
1002
            'siteId',
1003
            'langId',
1004
            Lang::class,
1005
            'id',
1006
            ['alias' => 'TranslateFieldLangList']
1007
        );
1008
1009
        $this->hasManyToMany(
1010
            'id',
1011
            TranslateField::class,
1012
            'siteId',
1013
            'tableId',
1014
            Table::class,
1015
            'id',
1016
            ['alias' => 'TranslateFieldTableList']
1017
        );
1018
1019
        $this->belongsTo('createdBy', User::class, 'id', ['alias' => 'CreatedByEntity']);
1020
1021
        $this->belongsTo('createdAs', User::class, 'id', ['alias' => 'CreatedAsEntity']);
1022
1023
        $this->belongsTo('updatedBy', User::class, 'id', ['alias' => 'UpdatedByEntity']);
1024
1025
        $this->belongsTo('updatedAs', User::class, 'id', ['alias' => 'UpdatedAsEntity']);
1026
1027
        $this->belongsTo('deletedAs', User::class, 'id', ['alias' => 'DeletedAsEntity']);
1028
1029
        $this->belongsTo('deletedBy', User::class, 'id', ['alias' => 'DeletedByEntity']);
1030
1031
        $this->belongsTo('restoredBy', User::class, 'id', ['alias' => 'RestoredByEntity']);
1032
1033
        $this->belongsTo('restoredAs', User::class, 'id', ['alias' => 'RestoredAsEntity']);
1034
    }
1035
    
1036
    /**
1037
     * Adds the default validations to the model.
1038
     * @param Validation|null $validator
1039
     * @return Validation
1040
     */
1041
    public function addDefaultValidations(?Validation $validator = null): Validation
1042
    {
1043
        $validator ??= new Validation();
1044
    
1045
        $this->addUnsignedIntValidation($validator, 'id', true);
1046
        $this->addStringLengthValidation($validator, 'uuid', 0, 36, false);
1047
        $this->addStringLengthValidation($validator, 'name', 0, 60, false);
1048
        $this->addStringLengthValidation($validator, 'description', 0, 240, true);
1049
        $this->addStringLengthValidation($validator, 'icon', 0, 64, true);
1050
        $this->addStringLengthValidation($validator, 'color', 0, 9, true);
1051
        $this->addInclusionInValidation($validator, 'status', ['active','inactive'], false);
1052
        $this->addUnsignedIntValidation($validator, 'deleted', false);
1053
        $this->addDateTimeValidation($validator, 'createdAt', false);
1054
        $this->addUnsignedIntValidation($validator, 'createdBy', true);
1055
        $this->addUnsignedIntValidation($validator, 'createdAs', true);
1056
        $this->addDateTimeValidation($validator, 'updatedAt', true);
1057
        $this->addUnsignedIntValidation($validator, 'updatedBy', true);
1058
        $this->addUnsignedIntValidation($validator, 'updatedAs', true);
1059
        $this->addDateTimeValidation($validator, 'deletedAt', true);
1060
        $this->addUnsignedIntValidation($validator, 'deletedAs', true);
1061
        $this->addUnsignedIntValidation($validator, 'deletedBy', true);
1062
        $this->addDateTimeValidation($validator, 'restoredAt', true);
1063
        $this->addUnsignedIntValidation($validator, 'restoredBy', true);
1064
        $this->addUnsignedIntValidation($validator, 'restoredAs', true);
1065
        
1066
        return $validator;
1067
    }
1068
1069
        
1070
    /**
1071
     * Returns an array that maps the column names of the database
1072
     * table to the corresponding property names of the model.
1073
     * 
1074
     * @returns array The array mapping the column names to the property names
1075
     */
1076
    public function columnMap(): array
1077
    {
1078
        return [
1079
            'id' => 'id',
1080
            'uuid' => 'uuid',
1081
            'name' => 'name',
1082
            'description' => 'description',
1083
            'icon' => 'icon',
1084
            'color' => 'color',
1085
            'status' => 'status',
1086
            'deleted' => 'deleted',
1087
            'created_at' => 'createdAt',
1088
            'created_by' => 'createdBy',
1089
            'created_as' => 'createdAs',
1090
            'updated_at' => 'updatedAt',
1091
            'updated_by' => 'updatedBy',
1092
            'updated_as' => 'updatedAs',
1093
            'deleted_at' => 'deletedAt',
1094
            'deleted_as' => 'deletedAs',
1095
            'deleted_by' => 'deletedBy',
1096
            'restored_at' => 'restoredAt',
1097
            'restored_by' => 'restoredBy',
1098
            'restored_as' => 'restoredAs',
1099
        ];
1100
    }
1101
}
1102