1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (c) 2014 Roave, LLC. |
4
|
|
|
* All rights reserved. |
5
|
|
|
* |
6
|
|
|
* Redistribution and use in source and binary forms, with or without |
7
|
|
|
* modification, are permitted provided that the following conditions |
8
|
|
|
* are met: |
9
|
|
|
* |
10
|
|
|
* * Redistributions of source code must retain the above copyright |
11
|
|
|
* notice, this list of conditions and the following disclaimer. |
12
|
|
|
* |
13
|
|
|
* * Redistributions in binary form must reproduce the above copyright |
14
|
|
|
* notice, this list of conditions and the following disclaimer in |
15
|
|
|
* the documentation and/or other materials provided with the |
16
|
|
|
* distribution. |
17
|
|
|
* |
18
|
|
|
* * Neither the names of the copyright holders nor the names of the |
19
|
|
|
* contributors may be used to endorse or promote products derived |
20
|
|
|
* from this software without specific prior written permission. |
21
|
|
|
* |
22
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
23
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
24
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
25
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
26
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
27
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
28
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
29
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
30
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
31
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
32
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
33
|
|
|
* POSSIBILITY OF SUCH DAMAGE. |
34
|
|
|
* |
35
|
|
|
* @author Antoine Hedgecock |
36
|
|
|
* |
37
|
|
|
* @copyright 2014 Roave, LLC |
38
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
39
|
|
|
*/ |
40
|
|
|
|
41
|
|
|
namespace Roave\EmailTemplates\Entity; |
42
|
|
|
|
43
|
|
|
use DateTime; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Class TemplateEntity |
47
|
|
|
* |
48
|
|
|
* The basic data structure used to store email templates in the database |
49
|
|
|
*/ |
50
|
|
|
class TemplateEntity |
51
|
|
|
{ |
52
|
|
|
/** |
53
|
|
|
* @var string |
54
|
|
|
*/ |
55
|
|
|
protected $id; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var string |
59
|
|
|
*/ |
60
|
|
|
protected $uuid; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* If the example parameters should be updated the next time it's used. |
64
|
|
|
* |
65
|
|
|
* @var bool |
66
|
|
|
*/ |
67
|
|
|
protected $updateParameters = false; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
protected $locale = null; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* A set of example parameters |
76
|
|
|
* |
77
|
|
|
* @var array |
78
|
|
|
*/ |
79
|
|
|
protected $parameters; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var string|null |
83
|
|
|
*/ |
84
|
|
|
protected $subject; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var string|null |
88
|
|
|
*/ |
89
|
|
|
protected $textBody; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @var string|null |
93
|
|
|
*/ |
94
|
|
|
protected $htmlBody; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* A description from the developers so the editors know what they are doing. |
98
|
|
|
* |
99
|
|
|
* @var string|null |
100
|
|
|
*/ |
101
|
|
|
protected $description; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* The last time the parameters where updated at |
105
|
|
|
* |
106
|
|
|
* @var \DateTime|null |
107
|
|
|
*/ |
108
|
|
|
protected $parametersUpdatedAt; |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @var DateTime|null |
112
|
|
|
*/ |
113
|
|
|
protected $createdAt; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @var DateTime|null |
117
|
|
|
*/ |
118
|
|
|
protected $updatedAt; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param string $id |
122
|
|
|
*/ |
123
|
1 |
|
public function setId($id) |
124
|
|
|
{ |
125
|
1 |
|
$this->id = (string) $id; |
126
|
1 |
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return string |
130
|
|
|
*/ |
131
|
1 |
|
public function getId() |
132
|
|
|
{ |
133
|
1 |
|
return $this->id; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @return string |
138
|
|
|
*/ |
139
|
1 |
|
public function getUuid() |
140
|
|
|
{ |
141
|
1 |
|
return $this->uuid; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @param string $uuid |
146
|
|
|
*/ |
147
|
1 |
|
public function setUuid($uuid) |
148
|
|
|
{ |
149
|
1 |
|
$this->uuid = $uuid; |
150
|
1 |
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @param string $locale |
154
|
|
|
*/ |
155
|
1 |
|
public function setLocale($locale) |
156
|
|
|
{ |
157
|
1 |
|
$this->locale = (string) $locale; |
158
|
1 |
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @return string |
162
|
|
|
*/ |
163
|
1 |
|
public function getLocale() |
164
|
|
|
{ |
165
|
1 |
|
return $this->locale; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @param string $template |
170
|
|
|
*/ |
171
|
1 |
|
public function setTextBody($template) |
172
|
|
|
{ |
173
|
1 |
|
$this->textBody = (string) $template; |
174
|
1 |
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @return string |
178
|
|
|
*/ |
179
|
1 |
|
public function getTextBody() |
180
|
|
|
{ |
181
|
1 |
|
return $this->textBody; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @param string $htmlBody |
186
|
|
|
*/ |
187
|
1 |
|
public function setHtmlBody($htmlBody) |
188
|
|
|
{ |
189
|
1 |
|
$this->htmlBody = (string) $htmlBody; |
190
|
1 |
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @return null|string |
194
|
|
|
*/ |
195
|
1 |
|
public function getHtmlBody() |
196
|
|
|
{ |
197
|
1 |
|
return $this->htmlBody; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @param array $variables |
202
|
|
|
*/ |
203
|
1 |
|
public function setParameters(array $variables) |
204
|
|
|
{ |
205
|
1 |
|
$this->parameters = $variables; |
206
|
1 |
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* @return array |
210
|
|
|
*/ |
211
|
1 |
|
public function getParameters() |
212
|
|
|
{ |
213
|
1 |
|
return $this->parameters; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* @param string $subject |
218
|
|
|
*/ |
219
|
1 |
|
public function setSubject($subject) |
220
|
|
|
{ |
221
|
1 |
|
$this->subject = (string) $subject; |
222
|
1 |
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* @return string |
226
|
|
|
*/ |
227
|
1 |
|
public function getSubject() |
228
|
|
|
{ |
229
|
1 |
|
return $this->subject; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* @param string $description |
234
|
|
|
*/ |
235
|
1 |
|
public function setDescription($description) |
236
|
|
|
{ |
237
|
1 |
|
$this->description = (string) $description; |
238
|
1 |
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @return string |
242
|
|
|
*/ |
243
|
1 |
|
public function getDescription() |
244
|
|
|
{ |
245
|
1 |
|
return $this->description; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* @param \DateTime|null $paramsUpdatedAt |
250
|
|
|
*/ |
251
|
1 |
|
public function setParametersUpdatedAt(DateTime $paramsUpdatedAt = null) |
252
|
|
|
{ |
253
|
1 |
|
$this->parametersUpdatedAt = $paramsUpdatedAt; |
254
|
1 |
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @return \DateTime|null |
258
|
|
|
*/ |
259
|
1 |
|
public function getParametersUpdatedAt() |
260
|
|
|
{ |
261
|
1 |
|
return $this->parametersUpdatedAt; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* @param boolean $updatedParams |
266
|
|
|
*/ |
267
|
1 |
|
public function setUpdateParameters($updatedParams) |
268
|
|
|
{ |
269
|
1 |
|
$this->updateParameters = (bool) $updatedParams; |
270
|
1 |
|
} |
271
|
|
|
|
272
|
|
|
/** |
273
|
|
|
* @return boolean |
274
|
|
|
*/ |
275
|
1 |
|
public function getUpdateParameters() |
276
|
|
|
{ |
277
|
1 |
|
return $this->updateParameters; |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* @return DateTime|null |
282
|
|
|
*/ |
283
|
1 |
|
public function getCreatedAt() |
284
|
|
|
{ |
285
|
1 |
|
return $this->createdAt; |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* @param DateTime|null $createdAt |
290
|
|
|
*/ |
291
|
1 |
|
public function setCreatedAt(DateTime $createdAt) |
292
|
|
|
{ |
293
|
1 |
|
$this->createdAt = $createdAt; |
294
|
1 |
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* @return DateTime|null |
298
|
|
|
*/ |
299
|
1 |
|
public function getUpdatedAt() |
300
|
|
|
{ |
301
|
1 |
|
return $this->updatedAt; |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* @param DateTime|null $updatedAt |
306
|
|
|
*/ |
307
|
1 |
|
public function setUpdatedAt(DateTime $updatedAt) |
308
|
|
|
{ |
309
|
1 |
|
$this->updatedAt = $updatedAt; |
310
|
1 |
|
} |
311
|
|
|
} |
312
|
|
|
|