EmailAbstract   F
last analyzed

Complexity

Total Complexity 61

Size/Duplication

Total Lines 988
Duplicated Lines 0 %

Test Coverage

Coverage 86.67%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 163
c 3
b 0
f 0
dl 0
loc 988
ccs 169
cts 195
cp 0.8667
rs 3.52
wmc 61

61 Methods

Rating   Name   Duplication   Size   Complexity  
A addDefaultValidations() 0 29 1
A addDefaultRelationships() 0 35 1
A setSent() 0 3 1
A setContent() 0 3 1
A setRestoredAt() 0 3 1
A setTemplateId() 0 3 1
A getFrom() 0 3 1
A setUpdatedAt() 0 3 1
A setBcc() 0 3 1
A getMeta() 0 3 1
A getDeletedAs() 0 3 1
A getRestoredAs() 0 3 1
A setUuid() 0 3 1
A setUpdatedAs() 0 3 1
A getReadReceiptTo() 0 3 1
A getCreatedBy() 0 3 1
A getDeleted() 0 3 1
A setUpdatedBy() 0 3 1
A columnMap() 0 32 1
A setRestoredBy() 0 3 1
A setSentAs() 0 3 1
A setCreatedBy() 0 3 1
A getTo() 0 3 1
A setId() 0 3 1
A getSent() 0 3 1
A getSentAt() 0 3 1
A getRestoredAt() 0 3 1
A setSentBy() 0 3 1
A setFrom() 0 3 1
A getCreatedAt() 0 3 1
A setSentAt() 0 3 1
A setViewPath() 0 3 1
A setRestoredAs() 0 3 1
A setMeta() 0 3 1
A setSubject() 0 3 1
A setCc() 0 3 1
A getTemplateId() 0 3 1
A getSentAs() 0 3 1
A getRestoredBy() 0 3 1
A getUpdatedBy() 0 3 1
A getContent() 0 3 1
A getUpdatedAs() 0 3 1
A setDeletedAs() 0 3 1
A getId() 0 3 1
A getCc() 0 3 1
A setCreatedAt() 0 3 1
A setDeleted() 0 3 1
A setDeletedAt() 0 3 1
A getDeletedBy() 0 3 1
A getBcc() 0 3 1
A setReadReceiptTo() 0 3 1
A getSubject() 0 3 1
A getUpdatedAt() 0 3 1
A getUuid() 0 3 1
A getCreatedAs() 0 3 1
A setCreatedAs() 0 3 1
A getSentBy() 0 3 1
A setDeletedBy() 0 3 1
A getViewPath() 0 3 1
A setTo() 0 3 1
A getDeletedAt() 0 3 1

How to fix   Complexity   

Complex Class

Complex classes like EmailAbstract often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use EmailAbstract, and based on these observations, apply Extract Interface, too.

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