1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the wow-apps/symfony-proxybonanza project |
4
|
|
|
* https://github.com/wow-apps/symfony-proxybonanza |
5
|
|
|
* |
6
|
|
|
* (c) 2016 WoW-Apps |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WowApps\ProxybonanzaBundle\Entity; |
13
|
|
|
|
14
|
|
|
use Doctrine\ORM\Mapping as ORM; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class Plan |
18
|
|
|
* @ORM\Table( |
19
|
|
|
* name="proxybonanza_plan", |
20
|
|
|
* options={"collate"="utf8_unicode_ci", "charset"="utf8", "engine"="InnoDB"} |
21
|
|
|
* ) |
22
|
|
|
* @ORM\Entity(repositoryClass="WowApps\ProxybonanzaBundle\Repository\PlanRepository") |
23
|
|
|
* @author Alexey Samara <[email protected]> |
24
|
|
|
* @package wow-apps/symfony-proxybonanza |
25
|
|
|
*/ |
26
|
|
|
class Plan |
27
|
|
|
{ |
28
|
|
|
const TABLE_NAME = 'proxybonanza_plan'; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var integer |
32
|
|
|
* @ORM\Column(name="plan_id", type="integer") |
33
|
|
|
* @ORM\Id |
34
|
|
|
*/ |
35
|
|
|
private $id; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
* @ORM\Column(name="plan_login", type="string", nullable=false) |
40
|
|
|
*/ |
41
|
|
|
private $login; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
* @ORM\Column(name="plan_password", type="string", nullable=false) |
46
|
|
|
*/ |
47
|
|
|
private $password; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var \DateTime |
51
|
|
|
* @ORM\Column(name="plan_expires", type="datetime", nullable=true) |
52
|
|
|
*/ |
53
|
|
|
private $expires; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var int |
57
|
|
|
* @ORM\Column(name="plan_bandwidth", type="integer", nullable=true) |
58
|
|
|
*/ |
59
|
|
|
private $bandwidth; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var \DateTime |
63
|
|
|
* @ORM\Column(name="plan_last_ip_change", type="datetime", nullable=true) |
64
|
|
|
*/ |
65
|
|
|
private $lastIpChange; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var string |
69
|
|
|
* @ORM\Column(name="plan_package_name", type="string", nullable=true) |
70
|
|
|
*/ |
71
|
|
|
private $packageName; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @var string |
75
|
|
|
* @ORM\Column(name="plan_package_bandwidth", type="string", nullable=true) |
76
|
|
|
*/ |
77
|
|
|
private $packageBandwidth; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var float |
81
|
|
|
* @ORM\Column(name="plan_package_price", type="decimal", precision=9, scale=2, nullable=true) |
82
|
|
|
*/ |
83
|
|
|
private $packagePrice; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @var int |
87
|
|
|
* @ORM\Column(name="plan_package_howmany_ips", type="integer", nullable=true) |
88
|
|
|
*/ |
89
|
|
|
private $packageHowmanyIps; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @var int |
93
|
|
|
* @ORM\Column(name="plan_package_price_per_gig", type="integer", nullable=true) |
94
|
|
|
*/ |
95
|
|
|
private $packagePricePerGig; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @var string |
99
|
|
|
* @ORM\Column(name="plan_package_type", type="string", nullable=true) |
100
|
|
|
*/ |
101
|
|
|
private $packageType; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @var \ArrayObject|Proxy[] |
105
|
|
|
*/ |
106
|
|
|
private $proxy; |
107
|
|
|
|
108
|
|
|
/** @var \ArrayObject|AuthIps[] */ |
109
|
|
|
private $authIps; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @return int |
113
|
|
|
*/ |
114
|
|
|
public function getId(): int |
115
|
|
|
{ |
116
|
|
|
return $this->id; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @param int $id |
121
|
|
|
* @return Plan |
122
|
|
|
*/ |
123
|
|
|
public function setId(int $id): Plan |
124
|
|
|
{ |
125
|
|
|
$this->id = $id; |
126
|
|
|
return $this; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @return string |
131
|
|
|
*/ |
132
|
|
|
public function getLogin(): string |
133
|
|
|
{ |
134
|
|
|
return $this->login; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @param string $login |
139
|
|
|
* @return Plan |
140
|
|
|
*/ |
141
|
|
|
public function setLogin(string $login): Plan |
142
|
|
|
{ |
143
|
|
|
$this->login = $login; |
144
|
|
|
return $this; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return string |
149
|
|
|
*/ |
150
|
|
|
public function getPassword(): string |
151
|
|
|
{ |
152
|
|
|
return $this->password; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @param string $password |
157
|
|
|
* @return Plan |
158
|
|
|
*/ |
159
|
|
|
public function setPassword(string $password): Plan |
160
|
|
|
{ |
161
|
|
|
$this->password = $password; |
162
|
|
|
return $this; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @return \DateTime |
167
|
|
|
*/ |
168
|
|
|
public function getExpires(): \DateTime |
169
|
|
|
{ |
170
|
|
|
return $this->expires; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @param \DateTime $expires |
175
|
|
|
* @return Plan |
176
|
|
|
*/ |
177
|
|
|
public function setExpires(\DateTime $expires): Plan |
178
|
|
|
{ |
179
|
|
|
$this->expires = $expires; |
180
|
|
|
return $this; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @return int |
185
|
|
|
*/ |
186
|
|
|
public function getBandwidth(): int |
187
|
|
|
{ |
188
|
|
|
return $this->bandwidth; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @param int $bandwidth |
193
|
|
|
* @return Plan |
194
|
|
|
*/ |
195
|
|
|
public function setBandwidth(int $bandwidth): Plan |
196
|
|
|
{ |
197
|
|
|
$this->bandwidth = $bandwidth; |
198
|
|
|
return $this; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @return \DateTime |
203
|
|
|
*/ |
204
|
|
|
public function getLastIpChange(): \DateTime |
205
|
|
|
{ |
206
|
|
|
return $this->lastIpChange; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @param \DateTime $lastIpChange |
211
|
|
|
* @return Plan |
212
|
|
|
*/ |
213
|
|
|
public function setLastIpChange(\DateTime $lastIpChange): Plan |
214
|
|
|
{ |
215
|
|
|
$this->lastIpChange = $lastIpChange; |
216
|
|
|
return $this; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @return string |
221
|
|
|
*/ |
222
|
|
|
public function getPackageName(): string |
223
|
|
|
{ |
224
|
|
|
return $this->packageName; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @param string $packageName |
229
|
|
|
* @return Plan |
230
|
|
|
*/ |
231
|
|
|
public function setPackageName(string $packageName): Plan |
232
|
|
|
{ |
233
|
|
|
$this->packageName = $packageName; |
234
|
|
|
return $this; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @return string |
239
|
|
|
*/ |
240
|
|
|
public function getPackageBandwidth(): string |
241
|
|
|
{ |
242
|
|
|
return $this->packageBandwidth; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @param string $packageBandwidth |
247
|
|
|
* @return Plan |
248
|
|
|
*/ |
249
|
|
|
public function setPackageBandwidth(string $packageBandwidth): Plan |
250
|
|
|
{ |
251
|
|
|
$this->packageBandwidth = $packageBandwidth; |
252
|
|
|
return $this; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* @return float |
257
|
|
|
*/ |
258
|
|
|
public function getPackagePrice(): float |
259
|
|
|
{ |
260
|
|
|
return $this->packagePrice; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* @param float $packagePrice |
265
|
|
|
* @return Plan |
266
|
|
|
*/ |
267
|
|
|
public function setPackagePrice(float $packagePrice): Plan |
268
|
|
|
{ |
269
|
|
|
$this->packagePrice = $packagePrice; |
270
|
|
|
return $this; |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
/** |
274
|
|
|
* @return int |
275
|
|
|
*/ |
276
|
|
|
public function getPackageHowmanyIps(): int |
277
|
|
|
{ |
278
|
|
|
return $this->packageHowmanyIps; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
/** |
282
|
|
|
* @param int $packageHowmanyIps |
283
|
|
|
* @return Plan |
284
|
|
|
*/ |
285
|
|
|
public function setPackageHowmanyIps(int $packageHowmanyIps): Plan |
286
|
|
|
{ |
287
|
|
|
$this->packageHowmanyIps = $packageHowmanyIps; |
288
|
|
|
return $this; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* @return int |
293
|
|
|
*/ |
294
|
|
|
public function getPackagePricePerGig(): int |
295
|
|
|
{ |
296
|
|
|
return $this->packagePricePerGig; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* @param int $packagePricePerGig |
301
|
|
|
* @return Plan |
302
|
|
|
*/ |
303
|
|
|
public function setPackagePricePerGig(int $packagePricePerGig): Plan |
304
|
|
|
{ |
305
|
|
|
$this->packagePricePerGig = $packagePricePerGig; |
306
|
|
|
return $this; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* @return string |
311
|
|
|
*/ |
312
|
|
|
public function getPackageType(): string |
313
|
|
|
{ |
314
|
|
|
return $this->packageType; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @param string $packageType |
319
|
|
|
* @return Plan |
320
|
|
|
*/ |
321
|
|
|
public function setPackageType(string $packageType): Plan |
322
|
|
|
{ |
323
|
|
|
$this->packageType = $packageType; |
324
|
|
|
return $this; |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
/** |
328
|
|
|
* @return \ArrayObject |
329
|
|
|
*/ |
330
|
|
|
public function getProxy(): \ArrayObject |
331
|
|
|
{ |
332
|
|
|
return $this->proxy; |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* @param \ArrayObject $proxy |
337
|
|
|
*/ |
338
|
|
|
public function setProxy(\ArrayObject $proxy) |
339
|
|
|
{ |
340
|
|
|
$this->proxy = $proxy; |
341
|
|
|
} |
342
|
|
|
|
343
|
|
|
/** |
344
|
|
|
* @param Proxy $proxy |
345
|
|
|
* @return Plan |
346
|
|
|
*/ |
347
|
|
|
public function appendProxy(Proxy $proxy): Plan |
348
|
|
|
{ |
349
|
|
|
if (!$this->proxy) { |
350
|
|
|
$this->proxy = new \ArrayObject(); |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
$this->proxy->offsetSet($proxy->getProxyId(), $proxy); |
354
|
|
|
|
355
|
|
|
return $this; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* @return \ArrayObject|AuthIps[] |
360
|
|
|
*/ |
361
|
|
|
public function getAuthIps() |
362
|
|
|
{ |
363
|
|
|
return $this->authIps; |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* @param \ArrayObject|AuthIps[] $authIps |
368
|
|
|
* @return Plan |
369
|
|
|
*/ |
370
|
|
|
public function setAuthIps($authIps) |
371
|
|
|
{ |
372
|
|
|
$this->authIps = $authIps; |
373
|
|
|
return $this; |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
/** |
377
|
|
|
* @param AuthIps $authIp |
378
|
|
|
* @return Plan |
379
|
|
|
*/ |
380
|
|
|
public function appendAuthIp(AuthIps $authIp): Plan |
381
|
|
|
{ |
382
|
|
|
if (!$this->authIps) { |
383
|
|
|
$this->authIps = new \ArrayObject(); |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
$this->authIps->offsetSet($authIp->getId(), $authIp); |
387
|
|
|
|
388
|
|
|
return $this; |
389
|
|
|
} |
390
|
|
|
} |
391
|
|
|
|