|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Ecodev\Felix\Model\Traits; |
|
6
|
|
|
|
|
7
|
|
|
use Cake\Chronos\Chronos; |
|
8
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
9
|
|
|
use GraphQL\Doctrine\Attribute as API; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* A message sent to a user. |
|
13
|
|
|
*/ |
|
14
|
|
|
trait Message |
|
15
|
|
|
{ |
|
16
|
|
|
#[ORM\Column(type: 'string', length: 191)] |
|
17
|
|
|
private string $email = ''; |
|
18
|
|
|
|
|
19
|
|
|
#[ORM\Column(type: 'MessageType')] |
|
20
|
|
|
private string $type; |
|
21
|
|
|
|
|
22
|
|
|
#[ORM\Column(type: 'datetime', nullable: true)] |
|
23
|
|
|
private ?Chronos $dateSent = null; |
|
24
|
|
|
|
|
25
|
|
|
#[ORM\Column(type: 'string', length: 255, options: ['default' => ''])] |
|
26
|
|
|
private string $subject = ''; |
|
27
|
|
|
|
|
28
|
|
|
#[ORM\Column(type: 'text', length: 65535, options: ['default' => ''])] |
|
29
|
|
|
private string $body = ''; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Set type. |
|
33
|
|
|
*/ |
|
34
|
|
|
#[API\Input(type: 'MessageType')] |
|
35
|
|
|
public function setType(string $type): void |
|
36
|
|
|
{ |
|
37
|
|
|
$this->type = $type; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Get type. |
|
42
|
|
|
*/ |
|
43
|
|
|
#[API\Field(type: 'MessageType')] |
|
44
|
|
|
public function getType(): string |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->type; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function getSubject(): string |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->subject; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function setSubject(string $subject): void |
|
55
|
|
|
{ |
|
56
|
|
|
$this->subject = $subject; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function getBody(): string |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->body; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function setBody(string $body): void |
|
65
|
|
|
{ |
|
66
|
|
|
$this->body = $body; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Get sent time. |
|
71
|
|
|
*/ |
|
72
|
|
|
public function getDateSent(): ?Chronos |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->dateSent; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Set sent time. |
|
79
|
|
|
*/ |
|
80
|
|
|
#[API\Exclude] |
|
81
|
|
|
public function setDateSent(?Chronos $dateSent): void |
|
82
|
|
|
{ |
|
83
|
|
|
$this->dateSent = $dateSent; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* Recipient email address. |
|
88
|
|
|
*/ |
|
89
|
|
|
public function getEmail(): string |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->email; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Recipient email address. |
|
96
|
|
|
*/ |
|
97
|
|
|
public function setEmail(string $email): void |
|
98
|
|
|
{ |
|
99
|
|
|
$this->email = $email; |
|
100
|
|
|
} |
|
101
|
|
|
} |
|
102
|
|
|
|