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|null |
32
|
|
|
* |
33
|
|
|
* @ORM\Column(name="export", type="datetime", nullable=true) |
34
|
|
|
*/ |
35
|
|
|
private $export; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var \DateTime|null |
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="source", type="string", length=50, nullable=true) |
84
|
|
|
*/ |
85
|
|
|
private $source; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @var \DateTime |
89
|
|
|
* @Gedmo\Timestampable(on="create") |
90
|
|
|
* @ORM\Column(type="datetime") |
91
|
|
|
*/ |
92
|
|
|
private $createdAt; |
93
|
|
|
|
94
|
|
|
/* public */ const STATUS_NEW = 0; |
95
|
|
|
/* public */ const STATUS_CONFIRMED = 1; |
96
|
|
|
/* public */ const STATUS_MODERATION = 2; |
97
|
|
|
|
98
|
|
|
public function setFullName( string $fullName ): self { |
99
|
|
|
$this->fullName = $fullName; |
100
|
|
|
|
101
|
|
|
return $this; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function getFullName(): string { |
105
|
|
|
return $this->fullName; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function setEmail( string $email ): self { |
109
|
|
|
$this->email = $email; |
110
|
|
|
|
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function getEmail(): string { |
115
|
|
|
return $this->email; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
public function setExport( \DateTime $export = null ): self { |
119
|
|
|
$this->export = $export; |
120
|
|
|
|
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return \DateTime|null |
126
|
|
|
*/ |
127
|
|
|
public function getExport() { |
128
|
|
|
return $this->export; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
public function setBackup( \DateTime $backup = null ): self { |
132
|
|
|
$this->backup = $backup; |
133
|
|
|
|
134
|
|
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @return \DateTime|null |
139
|
|
|
*/ |
140
|
|
|
public function getBackup() { |
141
|
|
|
return $this->backup; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
public function setStatus( int $status ): self { |
145
|
|
|
$this->status = $status; |
146
|
|
|
|
147
|
|
|
return $this; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public function getStatus(): int { |
151
|
|
|
return $this->status; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
public function setConfirmationCode( string $confirmationCode ): self { |
155
|
|
|
$this->confirmationCode = $confirmationCode; |
156
|
|
|
|
157
|
|
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
public function getConfirmationCode(): string { |
161
|
|
|
return $this->confirmationCode; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
public function getId(): int { |
165
|
|
|
return $this->id; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
public function getAddress(): Address { |
169
|
|
|
return $this->address; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
public function setAddress( Address $address ) { |
173
|
|
|
$this->address = $address; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
public function getCreatedAt(): \DateTime { |
177
|
|
|
return $this->createdAt; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
public function setCreatedAt( \DateTime $createdAt ): self { |
181
|
|
|
$this->createdAt = $createdAt; |
182
|
|
|
return $this; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
public function getTracking(): string { |
186
|
|
|
return $this->tracking; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
public function setTracking( string $tracking ) { |
190
|
|
|
$this->tracking = $tracking; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
public function isUnconfirmed(): bool { |
194
|
|
|
return $this->getStatus() === self::STATUS_NEW; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
public function getHexConfirmationCode(): string { |
198
|
|
|
return bin2hex( $this->confirmationCode ); |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
public function setHexConfirmationCode( string $confirmationCode ) { |
202
|
|
|
$this->confirmationCode = hex2bin( $confirmationCode ); |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
public function setSource( string $source ): self { |
206
|
1 |
|
$this->source = $source; |
207
|
1 |
|
|
208
|
|
|
return $this; |
209
|
1 |
|
} |
210
|
|
|
|
211
|
|
|
public function getSource(): string { |
212
|
|
|
return $this->source; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
} |
216
|
|
|
|