1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Citrax\Bundle\DatabaseSwiftMailerBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Email |
10
|
|
|
* |
11
|
|
|
* @ORM\Table(name="citrax_email_spool") |
12
|
|
|
* @ORM\Entity(repositoryClass="Citrax\Bundle\DatabaseSwiftMailerBundle\Entity\EmailRepository") |
13
|
|
|
*/ |
14
|
|
|
class Email |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
const STATUS_FAILED = 'FAILED'; |
18
|
|
|
const STATUS_READY = 'READY'; |
19
|
|
|
const STATUS_PROCESSING = 'PROCESSING'; |
20
|
|
|
const STATUS_COMPLETE = 'COMPLETE'; |
21
|
|
|
const STATUS_CANCELLED = 'CANCELLED'; |
22
|
|
|
|
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var integer |
26
|
|
|
* |
27
|
|
|
* @ORM\Column(name="id", type="integer") |
28
|
|
|
* @ORM\Id |
29
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
30
|
|
|
*/ |
31
|
|
|
private $id; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
* |
36
|
|
|
* @ORM\Column(name="subject", type="string", length=255) |
37
|
|
|
*/ |
38
|
|
|
private $subject; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string |
42
|
|
|
* |
43
|
|
|
* @ORM\Column(name="from_email", type="string", length=255) |
44
|
|
|
*/ |
45
|
|
|
private $fromEmail; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var string |
49
|
|
|
* |
50
|
|
|
* @ORM\Column(name="to_email", type="string", length=255, nullable=true) |
51
|
|
|
*/ |
52
|
|
|
private $toEmail; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var string |
56
|
|
|
* |
57
|
|
|
* @ORM\Column(name="cc_email", type="string", length=255, nullable=true) |
58
|
|
|
*/ |
59
|
|
|
private $ccEmail; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var string |
63
|
|
|
* |
64
|
|
|
* @ORM\Column(name="bcc_email", type="string", length=255, nullable=true) |
65
|
|
|
*/ |
66
|
|
|
private $bccEmail; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @var string |
70
|
|
|
* |
71
|
|
|
* @ORM\Column(name="reply_to_email", type="string", length=255, nullable=true) |
72
|
|
|
*/ |
73
|
|
|
private $replyToEmail; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @var string |
77
|
|
|
* |
78
|
|
|
* @ORM\Column(name="body", type="text") |
79
|
|
|
*/ |
80
|
|
|
private $body; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @var string |
84
|
|
|
* |
85
|
|
|
* @ORM\Column(name="message", type="text") |
86
|
|
|
*/ |
87
|
|
|
private $message; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @var string |
91
|
|
|
* |
92
|
|
|
* @ORM\Column(name="status", type="string", length=255) |
93
|
|
|
*/ |
94
|
|
|
private $status; |
95
|
|
|
|
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @var string |
99
|
|
|
* |
100
|
|
|
* @ORM\Column(name="retries", type="integer") |
101
|
|
|
*/ |
102
|
|
|
private $retries; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @var \DateTime $created |
106
|
|
|
* |
107
|
|
|
* @Gedmo\Timestampable(on="create") |
108
|
|
|
* @ORM\Column(name="created_at", type="datetime", nullable=true) |
109
|
|
|
*/ |
110
|
|
|
private $createdAt; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @var \DateTime $updated |
114
|
|
|
* |
115
|
|
|
* @Gedmo\Timestampable(on="update") |
116
|
|
|
* @ORM\Column(name="updated_at", type="datetime", nullable=true) |
117
|
|
|
*/ |
118
|
|
|
private $updatedAt; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @var string $createdBy |
122
|
|
|
* |
123
|
|
|
* @Gedmo\Blameable(on="create") |
124
|
|
|
* @ORM\Column(name="created_by", type="string", nullable=true) |
125
|
|
|
*/ |
126
|
|
|
private $createdBy; |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @var string $updatedBy |
130
|
|
|
* |
131
|
|
|
* @Gedmo\Blameable(on="update") |
132
|
|
|
* @ORM\Column(name="updated_by", type="string", nullable=true) |
133
|
|
|
*/ |
134
|
|
|
private $updatedBy; |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @var \DateTime $sentAt |
138
|
|
|
* |
139
|
|
|
* @ORM\Column(name="sent_at", type="datetime", nullable=true) |
140
|
|
|
*/ |
141
|
|
|
private $sentAt; |
142
|
|
|
|
143
|
|
|
|
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @var \Swift_Message |
147
|
|
|
* |
148
|
|
|
* @ORM\Column(name="error_message", type="text", nullable=true) |
149
|
|
|
*/ |
150
|
|
|
private $errorMessage; |
151
|
|
|
|
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Get id |
155
|
|
|
* |
156
|
|
|
* @return integer |
157
|
|
|
*/ |
158
|
|
|
public function getId() |
159
|
|
|
{ |
160
|
|
|
return $this->id; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* Set subject |
165
|
|
|
* |
166
|
|
|
* @param string $subject |
167
|
|
|
* @return Email |
168
|
|
|
*/ |
169
|
|
|
public function setSubject($subject) |
170
|
|
|
{ |
171
|
|
|
$this->subject = $subject; |
172
|
|
|
|
173
|
|
|
return $this; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Get subject |
178
|
|
|
* |
179
|
|
|
* @return string |
180
|
|
|
*/ |
181
|
|
|
public function getSubject() |
182
|
|
|
{ |
183
|
|
|
return $this->subject; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Set fromEmail |
188
|
|
|
* |
189
|
|
|
* @param string $fromEmail |
190
|
|
|
* @return Email |
191
|
|
|
*/ |
192
|
|
|
public function setFromEmail($fromEmail) |
193
|
|
|
{ |
194
|
|
|
$this->fromEmail = $fromEmail; |
195
|
|
|
|
196
|
|
|
return $this; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* Get fromEmail |
201
|
|
|
* |
202
|
|
|
* @return string |
203
|
|
|
*/ |
204
|
|
|
public function getFromEmail() |
205
|
|
|
{ |
206
|
|
|
return $this->fromEmail; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* Set toEmail |
211
|
|
|
* |
212
|
|
|
* @param string $toEmail |
213
|
|
|
* @return Email |
214
|
|
|
*/ |
215
|
|
|
public function setToEmail($toEmail) |
216
|
|
|
{ |
217
|
|
|
$this->toEmail = $toEmail; |
218
|
|
|
|
219
|
|
|
return $this; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* Get toEmail |
224
|
|
|
* |
225
|
|
|
* @return string |
226
|
|
|
*/ |
227
|
|
|
public function getToEmail() |
228
|
|
|
{ |
229
|
|
|
return $this->toEmail; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* @return string |
234
|
|
|
*/ |
235
|
|
|
public function getCcEmail() |
236
|
|
|
{ |
237
|
|
|
return $this->ccEmail; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @param string $ccEmail |
242
|
|
|
*/ |
243
|
|
|
public function setCcEmail($ccEmail) |
244
|
|
|
{ |
245
|
|
|
$this->ccEmail = $ccEmail; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* @return string |
250
|
|
|
*/ |
251
|
|
|
public function getBccEmail() |
252
|
|
|
{ |
253
|
|
|
return $this->bccEmail; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @param string $bccEmail |
258
|
|
|
*/ |
259
|
|
|
public function setBccEmail($bccEmail) |
260
|
|
|
{ |
261
|
|
|
$this->bccEmail = $bccEmail; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* @return string |
266
|
|
|
*/ |
267
|
|
|
public function getReplyToEmail() |
268
|
|
|
{ |
269
|
|
|
return $this->replyToEmail; |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
/** |
273
|
|
|
* @param string $replyToEmail |
274
|
|
|
* @return Email |
275
|
|
|
*/ |
276
|
|
|
public function setReplyToEmail($replyToEmail) |
277
|
|
|
{ |
278
|
|
|
$this->replyToEmail = $replyToEmail; |
279
|
|
|
return $this; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* @return string |
285
|
|
|
*/ |
286
|
|
|
public function getBody() |
287
|
|
|
{ |
288
|
|
|
return $this->body; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* @param string $body |
293
|
|
|
*/ |
294
|
|
|
public function setBody($body) |
295
|
|
|
{ |
296
|
|
|
$this->body = $body; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
|
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* @return \Swift_Mime_Message |
303
|
|
|
*/ |
304
|
|
|
public function getMessage() |
305
|
|
|
{ |
306
|
|
|
return unserialize(base64_decode($this->message)); |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* @param \Swift_Mime_Message $message |
311
|
|
|
*/ |
312
|
|
|
public function setMessage(\Swift_Mime_Message $message) |
313
|
|
|
{ |
314
|
|
|
$this->message = base64_encode(serialize($message)); |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @return \DateTime |
319
|
|
|
*/ |
320
|
|
|
public function getCreatedAt() |
321
|
|
|
{ |
322
|
|
|
return $this->createdAt; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* @param \DateTime $createdAt |
327
|
|
|
*/ |
328
|
|
|
public function setCreatedAt($createdAt) |
329
|
|
|
{ |
330
|
|
|
$this->createdAt = $createdAt; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* @return \DateTime |
335
|
|
|
*/ |
336
|
|
|
public function getUpdatedAt() |
337
|
|
|
{ |
338
|
|
|
return $this->updatedAt; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* @param \DateTime $updatedAt |
343
|
|
|
*/ |
344
|
|
|
public function setUpdatedAt($updatedAt) |
345
|
|
|
{ |
346
|
|
|
$this->updatedAt = $updatedAt; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
/** |
350
|
|
|
* @return \DateTime |
351
|
|
|
*/ |
352
|
|
|
public function getSentAt() |
353
|
|
|
{ |
354
|
|
|
return $this->sentAt; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* @param \DateTime $sentAt |
359
|
|
|
*/ |
360
|
|
|
public function setSentAt($sentAt) |
361
|
|
|
{ |
362
|
|
|
$this->sentAt = $sentAt; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
|
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* @return string |
369
|
|
|
*/ |
370
|
|
|
public function getCreatedBy() |
371
|
|
|
{ |
372
|
|
|
return $this->createdBy; |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* @param string $createdBy |
377
|
|
|
*/ |
378
|
|
|
public function setCreatedBy($createdBy) |
379
|
|
|
{ |
380
|
|
|
$this->createdBy = $createdBy; |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
/** |
384
|
|
|
* @return string |
385
|
|
|
*/ |
386
|
|
|
public function getUpdatedBy() |
387
|
|
|
{ |
388
|
|
|
return $this->updatedBy; |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
/** |
392
|
|
|
* @param string $updatedBy |
393
|
|
|
*/ |
394
|
|
|
public function setUpdatedBy($updatedBy) |
395
|
|
|
{ |
396
|
|
|
$this->updatedBy = $updatedBy; |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* @return \Swift_Message |
401
|
|
|
*/ |
402
|
|
|
public function getErrorMessage() |
403
|
|
|
{ |
404
|
|
|
return $this->errorMessage; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* @param \Swift_Message $errorMessage |
409
|
|
|
*/ |
410
|
|
|
public function setErrorMessage($errorMessage) |
411
|
|
|
{ |
412
|
|
|
$this->errorMessage = $errorMessage; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* @return string |
417
|
|
|
*/ |
418
|
|
|
public function getStatus() |
419
|
|
|
{ |
420
|
|
|
return $this->status; |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
/** |
424
|
|
|
* @param string $status |
425
|
|
|
*/ |
426
|
|
|
public function setStatus($status) |
427
|
|
|
{ |
428
|
|
|
$this->status = $status; |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
/** |
432
|
|
|
* @return string |
433
|
|
|
*/ |
434
|
|
|
public function getRetries() |
435
|
|
|
{ |
436
|
|
|
return $this->retries; |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* @param string $retries |
441
|
|
|
*/ |
442
|
|
|
public function setRetries($retries) |
443
|
|
|
{ |
444
|
|
|
$this->retries = $retries; |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
|
448
|
|
|
|
449
|
|
|
|
450
|
|
|
} |
451
|
|
|
|