1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WMDE\Fundraising\Entities; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @since 2.0 |
10
|
|
|
* |
11
|
|
|
* @ORM\Table( name="subscription" ) |
12
|
|
|
* @ORM\Entity |
13
|
|
|
*/ |
14
|
|
|
class Subscription { |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var string |
18
|
|
|
* |
19
|
|
|
* @ORM\Column(name="full_name", type="string", length=250, options={"default":""}, nullable=false) |
20
|
|
|
*/ |
21
|
|
|
private $fullName = ''; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
* |
26
|
|
|
* @ORM\Column(name="email", type="string", length=250, options={"default":""}, nullable=false) |
27
|
|
|
*/ |
28
|
|
|
private $email = ''; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var \DateTime |
32
|
|
|
* |
33
|
|
|
* @ORM\Column(name="export", type="datetime", nullable=true) |
34
|
|
|
*/ |
35
|
|
|
private $export; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var \DateTime |
39
|
|
|
* |
40
|
|
|
* @ORM\Column(name="backup", type="datetime", nullable=true) |
41
|
|
|
*/ |
42
|
|
|
private $backup; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var integer |
46
|
|
|
* |
47
|
|
|
* @ORM\Column(name="status", type="smallint", options={"default":0}, nullable=true) |
48
|
|
|
*/ |
49
|
|
|
private $status = 0; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var string |
53
|
|
|
* |
54
|
|
|
* @ORM\Column(name="confirmationCode", type="blob", length=16, nullable=true) |
55
|
|
|
*/ |
56
|
|
|
private $confirmationCode; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var integer |
60
|
|
|
* |
61
|
|
|
* @ORM\Column(name="id", type="integer") |
62
|
|
|
* @ORM\Id |
63
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
64
|
|
|
*/ |
65
|
|
|
private $id; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @ORM\ManyToOne(targetEntity="Address") |
69
|
|
|
* @ORM\JoinColumn(name="address_id", referencedColumnName="id") |
70
|
|
|
*/ |
71
|
|
|
private $address; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @var string |
75
|
|
|
* |
76
|
|
|
* @ORM\Column(name="tracking", type="string", length=50, nullable=true) |
77
|
|
|
*/ |
78
|
|
|
private $tracking; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @var string |
82
|
|
|
* |
83
|
|
|
* @ORM\Column(name="campaign_code", type="string", length=50, nullable=true) |
84
|
|
|
*/ |
85
|
|
|
private $campaignCode; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @var \DateTime |
89
|
|
|
* @Gedmo\Timestampable(on="create") |
90
|
|
|
* @ORM\Column(type="datetime") |
91
|
|
|
*/ |
92
|
|
|
private $createdAt; |
93
|
|
|
|
94
|
|
|
const STATUS_NEW = 0; |
95
|
|
|
const STATUS_CONFIRMED = 1; |
96
|
|
|
const STATUS_MODERATION = 2; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Set name |
100
|
|
|
* |
101
|
|
|
* @param string $fullName |
102
|
|
|
* @return self |
103
|
|
|
*/ |
104
|
|
|
public function setFullName( $fullName ) { |
105
|
|
|
$this->fullName = $fullName; |
106
|
|
|
|
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Get name |
112
|
|
|
* |
113
|
|
|
* @return string |
114
|
|
|
*/ |
115
|
|
|
public function getFullName() { |
116
|
|
|
return $this->fullName; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Set email |
121
|
|
|
* |
122
|
|
|
* @param string $email |
123
|
|
|
* @return self |
124
|
|
|
*/ |
125
|
|
|
public function setEmail( $email ) { |
126
|
|
|
$this->email = $email; |
127
|
|
|
|
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Get email |
133
|
|
|
* |
134
|
|
|
* @return string |
135
|
|
|
*/ |
136
|
|
|
public function getEmail() { |
137
|
|
|
return $this->email; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Set export |
142
|
|
|
* |
143
|
|
|
* @param \DateTime $export |
144
|
|
|
* @return self |
145
|
|
|
*/ |
146
|
|
|
public function setExport( $export ) { |
147
|
|
|
$this->export = $export; |
148
|
|
|
|
149
|
|
|
return $this; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Get export |
154
|
|
|
* |
155
|
|
|
* @return \DateTime |
156
|
|
|
*/ |
157
|
|
|
public function getExport() { |
158
|
|
|
return $this->export; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* Set backup |
163
|
|
|
* |
164
|
|
|
* @param \DateTime $backup |
165
|
|
|
* @return self |
166
|
|
|
*/ |
167
|
|
|
public function setBackup( $backup ) { |
168
|
|
|
$this->backup = $backup; |
169
|
|
|
|
170
|
|
|
return $this; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Get backup |
175
|
|
|
* |
176
|
|
|
* @return \DateTime |
177
|
|
|
*/ |
178
|
|
|
public function getBackup() { |
179
|
|
|
return $this->backup; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* Set status |
184
|
|
|
* |
185
|
|
|
* @param integer $status |
186
|
|
|
* @return self |
187
|
|
|
*/ |
188
|
|
|
public function setStatus( $status ) { |
189
|
|
|
$this->status = $status; |
190
|
|
|
|
191
|
|
|
return $this; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* Get status |
196
|
|
|
* |
197
|
|
|
* @return integer |
198
|
|
|
*/ |
199
|
|
|
public function getStatus() { |
200
|
|
|
return $this->status; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* Set guid |
205
|
|
|
* |
206
|
1 |
|
* @param string $confirmationCode |
207
|
1 |
|
* @return self |
208
|
|
|
*/ |
209
|
1 |
|
public function setConfirmationCode( $confirmationCode ) { |
210
|
|
|
$this->confirmationCode = $confirmationCode; |
211
|
|
|
|
212
|
|
|
return $this; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* Get guid |
217
|
1 |
|
* |
218
|
1 |
|
* @return string |
219
|
|
|
*/ |
220
|
|
|
public function getConfirmationCode() { |
221
|
|
|
return $this->confirmationCode; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* Get id |
226
|
|
|
* |
227
|
|
|
* @return integer |
228
|
|
|
*/ |
229
|
|
|
public function getId() { |
230
|
|
|
return $this->id; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* @return Address |
235
|
|
|
*/ |
236
|
|
|
public function getAddress() { |
237
|
|
|
return $this->address; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @return \DateTime |
242
|
|
|
*/ |
243
|
|
|
public function getCreatedAt() { |
244
|
|
|
return $this->createdAt; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* @param \DateTime $createdAt |
249
|
|
|
* @return self |
250
|
|
|
*/ |
251
|
|
|
public function setCreatedAt( $createdAt ) { |
252
|
|
|
$this->createdAt = $createdAt; |
253
|
|
|
return $this; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @return string |
258
|
|
|
*/ |
259
|
|
|
public function getTracking() { |
260
|
|
|
return $this->tracking; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* @param string $tracking |
265
|
|
|
*/ |
266
|
|
|
public function setTracking( $tracking ) { |
267
|
|
|
$this->tracking = $tracking; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @param Address $address |
272
|
|
|
*/ |
273
|
|
|
public function setAddress( $address ) { |
274
|
|
|
$this->address = $address; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
public function isUnconfirmed() { |
278
|
1 |
|
return $this->getStatus() === self::STATUS_NEUTRAL; |
279
|
1 |
|
} |
280
|
|
|
|
281
|
|
|
public function getHexConfirmationCode() { |
282
|
1 |
|
return bin2hex( $this->confirmationCode ); |
283
|
1 |
|
} |
284
|
1 |
|
|
285
|
|
|
public function setHexConfirmationCode( $confirmationCode ) { |
286
|
|
|
$this->confirmationCode = hex2bin( $confirmationCode ); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
public function setCampaignCode( string $campaignCode ) { |
290
|
|
|
$this->campaignCode = $campaignCode; |
291
|
|
|
return $this; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
public function getCampaignCode(): string { |
295
|
|
|
return $this->campaignCode; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
} |
299
|
|
|
|