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\Annotation as API; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* A message sent to a user |
13
|
|
|
*/ |
14
|
|
|
trait Message |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @var string |
18
|
|
|
* @ORM\Column(type="string", length=191) |
19
|
|
|
*/ |
20
|
|
|
private $email; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
* |
25
|
|
|
* @ORM\Column(type="MessageType") |
26
|
|
|
*/ |
27
|
|
|
private $type; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var null|Chronos |
31
|
|
|
* |
32
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
33
|
|
|
*/ |
34
|
|
|
private $dateSent; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string |
38
|
|
|
* |
39
|
|
|
* @ORM\Column(type="string", length=255, options={"default" = ""}) |
40
|
|
|
*/ |
41
|
|
|
private $subject = ''; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
* |
46
|
|
|
* @ORM\Column(type="text", length=65535, options={"default" = ""}) |
47
|
|
|
*/ |
48
|
|
|
private $body = ''; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Set type |
52
|
|
|
* |
53
|
|
|
* @API\Input(type="MessageType") |
54
|
|
|
* |
55
|
|
|
* @param string $type |
56
|
|
|
*/ |
57
|
|
|
public function setType(string $type): void |
58
|
|
|
{ |
59
|
|
|
$this->type = $type; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get type |
64
|
|
|
* |
65
|
|
|
* @API\Field(type="MessageType") |
66
|
|
|
* |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
|
|
public function getType(): string |
70
|
|
|
{ |
71
|
|
|
return $this->type; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return string |
76
|
|
|
*/ |
77
|
|
|
public function getSubject(): string |
78
|
|
|
{ |
79
|
|
|
return $this->subject; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param string $subject |
84
|
|
|
*/ |
85
|
|
|
public function setSubject(string $subject): void |
86
|
|
|
{ |
87
|
|
|
$this->subject = $subject; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return string |
92
|
|
|
*/ |
93
|
|
|
public function getBody(): string |
94
|
|
|
{ |
95
|
|
|
return $this->body; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param string $body |
100
|
|
|
*/ |
101
|
|
|
public function setBody(string $body): void |
102
|
|
|
{ |
103
|
|
|
$this->body = $body; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Get sent time |
108
|
|
|
* |
109
|
|
|
* @return null|Chronos |
110
|
|
|
*/ |
111
|
|
|
public function getDateSent(): ?Chronos |
112
|
|
|
{ |
113
|
|
|
return $this->dateSent; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Set sent time |
118
|
|
|
* |
119
|
|
|
* @API\Exclude |
120
|
|
|
* |
121
|
|
|
* @param null|Chronos $dateSent |
122
|
|
|
*/ |
123
|
|
|
public function setDateSent(?Chronos $dateSent): void |
124
|
|
|
{ |
125
|
|
|
$this->dateSent = $dateSent; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Recipient email address |
130
|
|
|
* |
131
|
|
|
* @return string |
132
|
|
|
*/ |
133
|
|
|
public function getEmail(): string |
134
|
|
|
{ |
135
|
|
|
return $this->email; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* Recipient email address |
140
|
|
|
* |
141
|
|
|
* @param string $email |
142
|
|
|
*/ |
143
|
|
|
public function setEmail(string $email): void |
144
|
|
|
{ |
145
|
|
|
$this->email = $email; |
146
|
|
|
} |
147
|
|
|
} |
148
|
|
|
|