1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Zemit Framework. |
5
|
|
|
* |
6
|
|
|
* (c) Zemit Team <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE.txt |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* -------------------------------------------------------------- |
12
|
|
|
* |
13
|
|
|
* New BSD License |
14
|
|
|
* |
15
|
|
|
* Copyright (c) 2017-present, Zemit CMS Team |
16
|
|
|
* All rights reserved. |
17
|
|
|
* |
18
|
|
|
* Redistribution and use in source and binary forms, with or without |
19
|
|
|
* modification, are permitted provided that the following conditions are met: |
20
|
|
|
* * Redistributions of source code must retain the above copyright |
21
|
|
|
* notice, this list of conditions and the following disclaimer. |
22
|
|
|
* * Redistributions in binary form must reproduce the above copyright |
23
|
|
|
* notice, this list of conditions and the following disclaimer in the |
24
|
|
|
* documentation and/or other materials provided with the distribution. |
25
|
|
|
* * Neither the name of the Zemit nor the |
26
|
|
|
* names of its contributors may be used to endorse or promote products |
27
|
|
|
* derived from this software without specific prior written permission. |
28
|
|
|
* |
29
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
30
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
31
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
32
|
|
|
* DISCLAIMED. IN NO EVENT SHALL ZEMIT FRAMEWORK TEAM BE LIABLE FOR ANY |
33
|
|
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
34
|
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
35
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
36
|
|
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
37
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
38
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
39
|
|
|
*/ |
40
|
|
|
|
41
|
|
|
namespace Zemit\Models\Abstracts; |
42
|
|
|
|
43
|
|
|
use Phalcon\Mvc\ModelInterface; |
44
|
|
|
use Phalcon\Mvc\Model\ResultInterface; |
45
|
|
|
use Phalcon\Mvc\Model\ResultsetInterface; |
46
|
|
|
use Phalcon\Validation; |
47
|
|
|
use Phalcon\Validation\Validator\Email as EmailValidator; |
48
|
|
|
use Zemit\Models\AbstractModel; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* AbstractUser |
52
|
|
|
* @package Zemit\Models\Base |
53
|
|
|
* @autogenerated by Phalcon Developer Tools |
54
|
|
|
* @date 2023-03-30, 04:45:32 |
55
|
|
|
*/ |
56
|
|
|
abstract class AbstractUser extends AbstractModel |
57
|
|
|
{ |
58
|
|
|
/** |
59
|
|
|
* @var integer |
60
|
|
|
* @Primary |
61
|
|
|
* @Identity |
62
|
|
|
* @Column(column="id", type="integer", nullable=false) |
63
|
|
|
*/ |
64
|
|
|
protected $id; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var string |
68
|
|
|
* @Column(column="email", type="string", length=255, nullable=true) |
69
|
|
|
*/ |
70
|
|
|
protected $email; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var string |
74
|
|
|
* @Column(column="username", type="string", length=120, nullable=true) |
75
|
|
|
*/ |
76
|
|
|
protected $username; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @var integer |
80
|
|
|
* @Column(column="mfa", type="integer", nullable=false) |
81
|
|
|
*/ |
82
|
|
|
protected $mfa; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @var string |
86
|
|
|
* @Column(column="mfa_secret", type="string", length=255, nullable=true) |
87
|
|
|
*/ |
88
|
|
|
protected $mfaSecret; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @var string |
92
|
|
|
* @Column(column="token", type="string", length=120, nullable=true) |
93
|
|
|
*/ |
94
|
|
|
protected $token; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @var string |
98
|
|
|
* @Column(column="password", type="string", length=255, nullable=true) |
99
|
|
|
*/ |
100
|
|
|
protected $password; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @var string |
104
|
|
|
* @Column(column="password_confirm", type="string", length=255, nullable=true) |
105
|
|
|
*/ |
106
|
|
|
protected $passwordConfirm; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @var string |
110
|
|
|
* @Column(column="salt", type="string", length=255, nullable=true) |
111
|
|
|
*/ |
112
|
|
|
protected $salt; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @var string |
116
|
|
|
* @Column(column="first_name", type="string", length=120, nullable=false) |
117
|
|
|
*/ |
118
|
|
|
protected $firstName; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @var string |
122
|
|
|
* @Column(column="last_name", type="string", length=120, nullable=false) |
123
|
|
|
*/ |
124
|
|
|
protected $lastName; |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @var integer |
128
|
|
|
* @Column(column="gender", type="integer", nullable=true) |
129
|
|
|
*/ |
130
|
|
|
protected $gender; |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @var string |
134
|
|
|
* @Column(column="dob", type="string", nullable=true) |
135
|
|
|
*/ |
136
|
|
|
protected $dob; |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @var string |
140
|
|
|
* @Column(column="title", type="string", length=120, nullable=true) |
141
|
|
|
*/ |
142
|
|
|
protected $title; |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @var string |
146
|
|
|
* @Column(column="phone", type="string", length=60, nullable=true) |
147
|
|
|
*/ |
148
|
|
|
protected $phone; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @var string |
152
|
|
|
* @Column(column="phone2", type="string", length=60, nullable=true) |
153
|
|
|
*/ |
154
|
|
|
protected $phone2; |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @var string |
158
|
|
|
* @Column(column="cellphone", type="string", length=60, nullable=true) |
159
|
|
|
*/ |
160
|
|
|
protected $cellphone; |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @var string |
164
|
|
|
* @Column(column="fax", type="string", length=60, nullable=true) |
165
|
|
|
*/ |
166
|
|
|
protected $fax; |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @var string |
170
|
|
|
* @Column(column="status", type="string", length='new','pending','approved','not_approved', nullable=true) |
171
|
|
|
*/ |
172
|
|
|
protected $status; |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @var string |
176
|
|
|
* @Column(column="category", type="string", length='company','employee','other','banned','guest', nullable=false) |
177
|
|
|
*/ |
178
|
|
|
protected $category; |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @var string |
182
|
|
|
* @Column(column="language", type="string", length='fr','en', nullable=false) |
183
|
|
|
*/ |
184
|
|
|
protected $language; |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @var integer |
188
|
|
|
* @Column(column="newsletter", type="integer", nullable=false) |
189
|
|
|
*/ |
190
|
|
|
protected $newsletter; |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @var integer |
194
|
|
|
* @Column(column="company_id", type="integer", nullable=true) |
195
|
|
|
*/ |
196
|
|
|
protected $companyId; |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @var integer |
200
|
|
|
* @Column(column="deleted", type="integer", nullable=false) |
201
|
|
|
*/ |
202
|
|
|
protected $deleted; |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @var string |
206
|
|
|
* @Column(column="created_at", type="string", nullable=false) |
207
|
|
|
*/ |
208
|
|
|
protected $createdAt; |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @var integer |
212
|
|
|
* @Column(column="created_by", type="integer", nullable=true) |
213
|
|
|
*/ |
214
|
|
|
protected $createdBy; |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* @var integer |
218
|
|
|
* @Column(column="created_as", type="integer", nullable=true) |
219
|
|
|
*/ |
220
|
|
|
protected $createdAs; |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* @var string |
224
|
|
|
* @Column(column="updated_at", type="string", nullable=true) |
225
|
|
|
*/ |
226
|
|
|
protected $updatedAt; |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @var integer |
230
|
|
|
* @Column(column="updated_by", type="integer", nullable=true) |
231
|
|
|
*/ |
232
|
|
|
protected $updatedBy; |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* @var integer |
236
|
|
|
* @Column(column="updated_as", type="integer", nullable=true) |
237
|
|
|
*/ |
238
|
|
|
protected $updatedAs; |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @var string |
242
|
|
|
* @Column(column="deleted_at", type="string", nullable=true) |
243
|
|
|
*/ |
244
|
|
|
protected $deletedAt; |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* @var integer |
248
|
|
|
* @Column(column="deleted_as", type="integer", nullable=true) |
249
|
|
|
*/ |
250
|
|
|
protected $deletedAs; |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* @var integer |
254
|
|
|
* @Column(column="deleted_by", type="integer", nullable=true) |
255
|
|
|
*/ |
256
|
|
|
protected $deletedBy; |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* @var string |
260
|
|
|
* @Column(column="restored_at", type="string", nullable=true) |
261
|
|
|
*/ |
262
|
|
|
protected $restoredAt; |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* @var integer |
266
|
|
|
* @Column(column="restored_by", type="integer", nullable=true) |
267
|
|
|
*/ |
268
|
|
|
protected $restoredBy; |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @var integer |
272
|
|
|
* @Column(column="restored_as", type="integer", nullable=true) |
273
|
|
|
*/ |
274
|
|
|
protected $restoredAs; |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* Method to set the value of field id |
278
|
|
|
* |
279
|
|
|
* @param integer $id |
280
|
|
|
* @return $this |
281
|
|
|
*/ |
282
|
|
|
public function setId($id) |
283
|
|
|
{ |
284
|
|
|
$this->id = $id; |
285
|
|
|
|
286
|
|
|
return $this; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* Returns the value of field id |
291
|
|
|
* |
292
|
|
|
* @return integer |
293
|
|
|
*/ |
294
|
|
|
public function getId() |
295
|
|
|
{ |
296
|
|
|
return $this->id; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* Method to set the value of field email |
301
|
|
|
* |
302
|
|
|
* @param string $email |
303
|
|
|
* @return $this |
304
|
|
|
*/ |
305
|
|
|
public function setEmail($email) |
306
|
|
|
{ |
307
|
|
|
$this->email = $email; |
308
|
|
|
|
309
|
|
|
return $this; |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* Returns the value of field email |
314
|
|
|
* |
315
|
|
|
* @return string |
316
|
|
|
*/ |
317
|
|
|
public function getEmail() |
318
|
|
|
{ |
319
|
|
|
return $this->email; |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* Method to set the value of field username |
324
|
|
|
* |
325
|
|
|
* @param string $username |
326
|
|
|
* @return $this |
327
|
|
|
*/ |
328
|
|
|
public function setUsername($username) |
329
|
|
|
{ |
330
|
|
|
$this->username = $username; |
331
|
|
|
|
332
|
|
|
return $this; |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* Returns the value of field username |
337
|
|
|
* |
338
|
|
|
* @return string |
339
|
|
|
*/ |
340
|
|
|
public function getUsername() |
341
|
|
|
{ |
342
|
|
|
return $this->username; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* Method to set the value of field mfa |
347
|
|
|
* |
348
|
|
|
* @param integer $mfa |
349
|
|
|
* @return $this |
350
|
|
|
*/ |
351
|
|
|
public function setMfa($mfa) |
352
|
|
|
{ |
353
|
|
|
$this->mfa = $mfa; |
354
|
|
|
|
355
|
|
|
return $this; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* Returns the value of field mfa |
360
|
|
|
* |
361
|
|
|
* @return integer |
362
|
|
|
*/ |
363
|
|
|
public function getMfa() |
364
|
|
|
{ |
365
|
|
|
return $this->mfa; |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
/** |
369
|
|
|
* Method to set the value of field mfa_secret |
370
|
|
|
* |
371
|
|
|
* @param string $mfaSecret |
372
|
|
|
* @return $this |
373
|
|
|
*/ |
374
|
|
|
public function setMfaSecret($mfaSecret) |
375
|
|
|
{ |
376
|
|
|
$this->mfaSecret = $mfaSecret; |
377
|
|
|
|
378
|
|
|
return $this; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* Returns the value of field mfa_secret |
383
|
|
|
* |
384
|
|
|
* @return string |
385
|
|
|
*/ |
386
|
|
|
public function getMfaSecret() |
387
|
|
|
{ |
388
|
|
|
return $this->mfaSecret; |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
/** |
392
|
|
|
* Method to set the value of field token |
393
|
|
|
* |
394
|
|
|
* @param string $token |
395
|
|
|
* @return $this |
396
|
|
|
*/ |
397
|
|
|
public function setToken($token) |
398
|
|
|
{ |
399
|
|
|
$this->token = $token; |
400
|
|
|
|
401
|
|
|
return $this; |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
/** |
405
|
|
|
* Returns the value of field token |
406
|
|
|
* |
407
|
|
|
* @return string |
408
|
|
|
*/ |
409
|
|
|
public function getToken() |
410
|
|
|
{ |
411
|
|
|
return $this->token; |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* Method to set the value of field password |
416
|
|
|
* |
417
|
|
|
* @param string $password |
418
|
|
|
* @return $this |
419
|
|
|
*/ |
420
|
|
|
public function setPassword($password) |
421
|
|
|
{ |
422
|
|
|
$this->password = $password; |
423
|
|
|
|
424
|
|
|
return $this; |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
/** |
428
|
|
|
* Returns the value of field password |
429
|
|
|
* |
430
|
|
|
* @return string |
431
|
|
|
*/ |
432
|
|
|
public function getPassword() |
433
|
|
|
{ |
434
|
|
|
return $this->password; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* Method to set the value of field password_confirm |
439
|
|
|
* |
440
|
|
|
* @param string $passwordConfirm |
441
|
|
|
* @return $this |
442
|
|
|
*/ |
443
|
|
|
public function setPasswordConfirm($passwordConfirm) |
444
|
|
|
{ |
445
|
|
|
$this->passwordConfirm = $passwordConfirm; |
446
|
|
|
|
447
|
|
|
return $this; |
448
|
|
|
} |
449
|
|
|
|
450
|
|
|
/** |
451
|
|
|
* Returns the value of field password_confirm |
452
|
|
|
* |
453
|
|
|
* @return string |
454
|
|
|
*/ |
455
|
|
|
public function getPasswordConfirm() |
456
|
|
|
{ |
457
|
|
|
return $this->passwordConfirm; |
458
|
|
|
} |
459
|
|
|
|
460
|
|
|
/** |
461
|
|
|
* Method to set the value of field salt |
462
|
|
|
* |
463
|
|
|
* @param string $salt |
464
|
|
|
* @return $this |
465
|
|
|
*/ |
466
|
|
|
public function setSalt($salt) |
467
|
|
|
{ |
468
|
|
|
$this->salt = $salt; |
469
|
|
|
|
470
|
|
|
return $this; |
471
|
|
|
} |
472
|
|
|
|
473
|
|
|
/** |
474
|
|
|
* Returns the value of field salt |
475
|
|
|
* |
476
|
|
|
* @return string |
477
|
|
|
*/ |
478
|
|
|
public function getSalt() |
479
|
|
|
{ |
480
|
|
|
return $this->salt; |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
/** |
484
|
|
|
* Method to set the value of field first_name |
485
|
|
|
* |
486
|
|
|
* @param string $firstName |
487
|
|
|
* @return $this |
488
|
|
|
*/ |
489
|
|
|
public function setFirstName($firstName) |
490
|
|
|
{ |
491
|
|
|
$this->firstName = $firstName; |
492
|
|
|
|
493
|
|
|
return $this; |
494
|
|
|
} |
495
|
|
|
|
496
|
|
|
/** |
497
|
|
|
* Returns the value of field first_name |
498
|
|
|
* |
499
|
|
|
* @return string |
500
|
|
|
*/ |
501
|
|
|
public function getFirstName() |
502
|
|
|
{ |
503
|
|
|
return $this->firstName; |
504
|
|
|
} |
505
|
|
|
|
506
|
|
|
/** |
507
|
|
|
* Method to set the value of field last_name |
508
|
|
|
* |
509
|
|
|
* @param string $lastName |
510
|
|
|
* @return $this |
511
|
|
|
*/ |
512
|
|
|
public function setLastName($lastName) |
513
|
|
|
{ |
514
|
|
|
$this->lastName = $lastName; |
515
|
|
|
|
516
|
|
|
return $this; |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
/** |
520
|
|
|
* Returns the value of field last_name |
521
|
|
|
* |
522
|
|
|
* @return string |
523
|
|
|
*/ |
524
|
|
|
public function getLastName() |
525
|
|
|
{ |
526
|
|
|
return $this->lastName; |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
/** |
530
|
|
|
* Method to set the value of field gender |
531
|
|
|
* |
532
|
|
|
* @param integer $gender |
533
|
|
|
* @return $this |
534
|
|
|
*/ |
535
|
|
|
public function setGender($gender) |
536
|
|
|
{ |
537
|
|
|
$this->gender = $gender; |
538
|
|
|
|
539
|
|
|
return $this; |
540
|
|
|
} |
541
|
|
|
|
542
|
|
|
/** |
543
|
|
|
* Returns the value of field gender |
544
|
|
|
* |
545
|
|
|
* @return integer |
546
|
|
|
*/ |
547
|
|
|
public function getGender() |
548
|
|
|
{ |
549
|
|
|
return $this->gender; |
550
|
|
|
} |
551
|
|
|
|
552
|
|
|
/** |
553
|
|
|
* Method to set the value of field dob |
554
|
|
|
* |
555
|
|
|
* @param string $dob |
556
|
|
|
* @return $this |
557
|
|
|
*/ |
558
|
|
|
public function setDob($dob) |
559
|
|
|
{ |
560
|
|
|
$this->dob = $dob; |
561
|
|
|
|
562
|
|
|
return $this; |
563
|
|
|
} |
564
|
|
|
|
565
|
|
|
/** |
566
|
|
|
* Returns the value of field dob |
567
|
|
|
* |
568
|
|
|
* @return string |
569
|
|
|
*/ |
570
|
|
|
public function getDob() |
571
|
|
|
{ |
572
|
|
|
return $this->dob; |
573
|
|
|
} |
574
|
|
|
|
575
|
|
|
/** |
576
|
|
|
* Method to set the value of field title |
577
|
|
|
* |
578
|
|
|
* @param string $title |
579
|
|
|
* @return $this |
580
|
|
|
*/ |
581
|
|
|
public function setTitle($title) |
582
|
|
|
{ |
583
|
|
|
$this->title = $title; |
584
|
|
|
|
585
|
|
|
return $this; |
586
|
|
|
} |
587
|
|
|
|
588
|
|
|
/** |
589
|
|
|
* Returns the value of field title |
590
|
|
|
* |
591
|
|
|
* @return string |
592
|
|
|
*/ |
593
|
|
|
public function getTitle() |
594
|
|
|
{ |
595
|
|
|
return $this->title; |
596
|
|
|
} |
597
|
|
|
|
598
|
|
|
/** |
599
|
|
|
* Method to set the value of field phone |
600
|
|
|
* |
601
|
|
|
* @param string $phone |
602
|
|
|
* @return $this |
603
|
|
|
*/ |
604
|
|
|
public function setPhone($phone) |
605
|
|
|
{ |
606
|
|
|
$this->phone = $phone; |
607
|
|
|
|
608
|
|
|
return $this; |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
/** |
612
|
|
|
* Returns the value of field phone |
613
|
|
|
* |
614
|
|
|
* @return string |
615
|
|
|
*/ |
616
|
|
|
public function getPhone() |
617
|
|
|
{ |
618
|
|
|
return $this->phone; |
619
|
|
|
} |
620
|
|
|
|
621
|
|
|
/** |
622
|
|
|
* Method to set the value of field phone2 |
623
|
|
|
* |
624
|
|
|
* @param string $phone2 |
625
|
|
|
* @return $this |
626
|
|
|
*/ |
627
|
|
|
public function setPhone2($phone2) |
628
|
|
|
{ |
629
|
|
|
$this->phone2 = $phone2; |
630
|
|
|
|
631
|
|
|
return $this; |
632
|
|
|
} |
633
|
|
|
|
634
|
|
|
/** |
635
|
|
|
* Returns the value of field phone2 |
636
|
|
|
* |
637
|
|
|
* @return string |
638
|
|
|
*/ |
639
|
|
|
public function getPhone2() |
640
|
|
|
{ |
641
|
|
|
return $this->phone2; |
642
|
|
|
} |
643
|
|
|
|
644
|
|
|
/** |
645
|
|
|
* Method to set the value of field cellphone |
646
|
|
|
* |
647
|
|
|
* @param string $cellphone |
648
|
|
|
* @return $this |
649
|
|
|
*/ |
650
|
|
|
public function setCellphone($cellphone) |
651
|
|
|
{ |
652
|
|
|
$this->cellphone = $cellphone; |
653
|
|
|
|
654
|
|
|
return $this; |
655
|
|
|
} |
656
|
|
|
|
657
|
|
|
/** |
658
|
|
|
* Returns the value of field cellphone |
659
|
|
|
* |
660
|
|
|
* @return string |
661
|
|
|
*/ |
662
|
|
|
public function getCellphone() |
663
|
|
|
{ |
664
|
|
|
return $this->cellphone; |
665
|
|
|
} |
666
|
|
|
|
667
|
|
|
/** |
668
|
|
|
* Method to set the value of field fax |
669
|
|
|
* |
670
|
|
|
* @param string $fax |
671
|
|
|
* @return $this |
672
|
|
|
*/ |
673
|
|
|
public function setFax($fax) |
674
|
|
|
{ |
675
|
|
|
$this->fax = $fax; |
676
|
|
|
|
677
|
|
|
return $this; |
678
|
|
|
} |
679
|
|
|
|
680
|
|
|
/** |
681
|
|
|
* Returns the value of field fax |
682
|
|
|
* |
683
|
|
|
* @return string |
684
|
|
|
*/ |
685
|
|
|
public function getFax() |
686
|
|
|
{ |
687
|
|
|
return $this->fax; |
688
|
|
|
} |
689
|
|
|
|
690
|
|
|
/** |
691
|
|
|
* Method to set the value of field status |
692
|
|
|
* |
693
|
|
|
* @param string $status |
694
|
|
|
* @return $this |
695
|
|
|
*/ |
696
|
|
|
public function setStatus($status) |
697
|
|
|
{ |
698
|
|
|
$this->status = $status; |
699
|
|
|
|
700
|
|
|
return $this; |
701
|
|
|
} |
702
|
|
|
|
703
|
|
|
/** |
704
|
|
|
* Returns the value of field status |
705
|
|
|
* |
706
|
|
|
* @return string |
707
|
|
|
*/ |
708
|
|
|
public function getStatus() |
709
|
|
|
{ |
710
|
|
|
return $this->status; |
711
|
|
|
} |
712
|
|
|
|
713
|
|
|
/** |
714
|
|
|
* Method to set the value of field category |
715
|
|
|
* |
716
|
|
|
* @param string $category |
717
|
|
|
* @return $this |
718
|
|
|
*/ |
719
|
|
|
public function setCategory($category) |
720
|
|
|
{ |
721
|
|
|
$this->category = $category; |
722
|
|
|
|
723
|
|
|
return $this; |
724
|
|
|
} |
725
|
|
|
|
726
|
|
|
/** |
727
|
|
|
* Returns the value of field category |
728
|
|
|
* |
729
|
|
|
* @return string |
730
|
|
|
*/ |
731
|
|
|
public function getCategory() |
732
|
|
|
{ |
733
|
|
|
return $this->category; |
734
|
|
|
} |
735
|
|
|
|
736
|
|
|
/** |
737
|
|
|
* Method to set the value of field language |
738
|
|
|
* |
739
|
|
|
* @param string $language |
740
|
|
|
* @return $this |
741
|
|
|
*/ |
742
|
|
|
public function setLanguage($language) |
743
|
|
|
{ |
744
|
|
|
$this->language = $language; |
745
|
|
|
|
746
|
|
|
return $this; |
747
|
|
|
} |
748
|
|
|
|
749
|
|
|
/** |
750
|
|
|
* Returns the value of field language |
751
|
|
|
* |
752
|
|
|
* @return string |
753
|
|
|
*/ |
754
|
|
|
public function getLanguage() |
755
|
|
|
{ |
756
|
|
|
return $this->language; |
757
|
|
|
} |
758
|
|
|
|
759
|
|
|
/** |
760
|
|
|
* Method to set the value of field newsletter |
761
|
|
|
* |
762
|
|
|
* @param integer $newsletter |
763
|
|
|
* @return $this |
764
|
|
|
*/ |
765
|
|
|
public function setNewsletter($newsletter) |
766
|
|
|
{ |
767
|
|
|
$this->newsletter = $newsletter; |
768
|
|
|
|
769
|
|
|
return $this; |
770
|
|
|
} |
771
|
|
|
|
772
|
|
|
/** |
773
|
|
|
* Returns the value of field newsletter |
774
|
|
|
* |
775
|
|
|
* @return integer |
776
|
|
|
*/ |
777
|
|
|
public function getNewsletter() |
778
|
|
|
{ |
779
|
|
|
return $this->newsletter; |
780
|
|
|
} |
781
|
|
|
|
782
|
|
|
/** |
783
|
|
|
* Method to set the value of field company_id |
784
|
|
|
* |
785
|
|
|
* @param integer $companyId |
786
|
|
|
* @return $this |
787
|
|
|
*/ |
788
|
|
|
public function setCompanyId($companyId) |
789
|
|
|
{ |
790
|
|
|
$this->companyId = $companyId; |
791
|
|
|
|
792
|
|
|
return $this; |
793
|
|
|
} |
794
|
|
|
|
795
|
|
|
/** |
796
|
|
|
* Returns the value of field company_id |
797
|
|
|
* |
798
|
|
|
* @return integer |
799
|
|
|
*/ |
800
|
|
|
public function getCompanyId() |
801
|
|
|
{ |
802
|
|
|
return $this->companyId; |
803
|
|
|
} |
804
|
|
|
|
805
|
|
|
/** |
806
|
|
|
* Method to set the value of field deleted |
807
|
|
|
* |
808
|
|
|
* @param integer $deleted |
809
|
|
|
* @return $this |
810
|
|
|
*/ |
811
|
|
|
public function setDeleted($deleted) |
812
|
|
|
{ |
813
|
|
|
$this->deleted = $deleted; |
814
|
|
|
|
815
|
|
|
return $this; |
816
|
|
|
} |
817
|
|
|
|
818
|
|
|
/** |
819
|
|
|
* Returns the value of field deleted |
820
|
|
|
* |
821
|
|
|
* @return integer |
822
|
|
|
*/ |
823
|
|
|
public function getDeleted() |
824
|
|
|
{ |
825
|
|
|
return $this->deleted; |
826
|
|
|
} |
827
|
|
|
|
828
|
|
|
/** |
829
|
|
|
* Method to set the value of field created_at |
830
|
|
|
* |
831
|
|
|
* @param string $createdAt |
832
|
|
|
* @return $this |
833
|
|
|
*/ |
834
|
|
|
public function setCreatedAt($createdAt) |
835
|
|
|
{ |
836
|
|
|
$this->createdAt = $createdAt; |
837
|
|
|
|
838
|
|
|
return $this; |
839
|
|
|
} |
840
|
|
|
|
841
|
|
|
/** |
842
|
|
|
* Returns the value of field created_at |
843
|
|
|
* |
844
|
|
|
* @return string |
845
|
|
|
*/ |
846
|
|
|
public function getCreatedAt() |
847
|
|
|
{ |
848
|
|
|
return $this->createdAt; |
849
|
|
|
} |
850
|
|
|
|
851
|
|
|
/** |
852
|
|
|
* Method to set the value of field created_by |
853
|
|
|
* |
854
|
|
|
* @param integer $createdBy |
855
|
|
|
* @return $this |
856
|
|
|
*/ |
857
|
|
|
public function setCreatedBy($createdBy) |
858
|
|
|
{ |
859
|
|
|
$this->createdBy = $createdBy; |
860
|
|
|
|
861
|
|
|
return $this; |
862
|
|
|
} |
863
|
|
|
|
864
|
|
|
/** |
865
|
|
|
* Returns the value of field created_by |
866
|
|
|
* |
867
|
|
|
* @return integer |
868
|
|
|
*/ |
869
|
|
|
public function getCreatedBy() |
870
|
|
|
{ |
871
|
|
|
return $this->createdBy; |
872
|
|
|
} |
873
|
|
|
|
874
|
|
|
/** |
875
|
|
|
* Method to set the value of field created_as |
876
|
|
|
* |
877
|
|
|
* @param integer $createdAs |
878
|
|
|
* @return $this |
879
|
|
|
*/ |
880
|
|
|
public function setCreatedAs($createdAs) |
881
|
|
|
{ |
882
|
|
|
$this->createdAs = $createdAs; |
883
|
|
|
|
884
|
|
|
return $this; |
885
|
|
|
} |
886
|
|
|
|
887
|
|
|
/** |
888
|
|
|
* Returns the value of field created_as |
889
|
|
|
* |
890
|
|
|
* @return integer |
891
|
|
|
*/ |
892
|
|
|
public function getCreatedAs() |
893
|
|
|
{ |
894
|
|
|
return $this->createdAs; |
895
|
|
|
} |
896
|
|
|
|
897
|
|
|
/** |
898
|
|
|
* Method to set the value of field updated_at |
899
|
|
|
* |
900
|
|
|
* @param string $updatedAt |
901
|
|
|
* @return $this |
902
|
|
|
*/ |
903
|
|
|
public function setUpdatedAt($updatedAt) |
904
|
|
|
{ |
905
|
|
|
$this->updatedAt = $updatedAt; |
906
|
|
|
|
907
|
|
|
return $this; |
908
|
|
|
} |
909
|
|
|
|
910
|
|
|
/** |
911
|
|
|
* Returns the value of field updated_at |
912
|
|
|
* |
913
|
|
|
* @return string |
914
|
|
|
*/ |
915
|
|
|
public function getUpdatedAt() |
916
|
|
|
{ |
917
|
|
|
return $this->updatedAt; |
918
|
|
|
} |
919
|
|
|
|
920
|
|
|
/** |
921
|
|
|
* Method to set the value of field updated_by |
922
|
|
|
* |
923
|
|
|
* @param integer $updatedBy |
924
|
|
|
* @return $this |
925
|
|
|
*/ |
926
|
|
|
public function setUpdatedBy($updatedBy) |
927
|
|
|
{ |
928
|
|
|
$this->updatedBy = $updatedBy; |
929
|
|
|
|
930
|
|
|
return $this; |
931
|
|
|
} |
932
|
|
|
|
933
|
|
|
/** |
934
|
|
|
* Returns the value of field updated_by |
935
|
|
|
* |
936
|
|
|
* @return integer |
937
|
|
|
*/ |
938
|
|
|
public function getUpdatedBy() |
939
|
|
|
{ |
940
|
|
|
return $this->updatedBy; |
941
|
|
|
} |
942
|
|
|
|
943
|
|
|
/** |
944
|
|
|
* Method to set the value of field updated_as |
945
|
|
|
* |
946
|
|
|
* @param integer $updatedAs |
947
|
|
|
* @return $this |
948
|
|
|
*/ |
949
|
|
|
public function setUpdatedAs($updatedAs) |
950
|
|
|
{ |
951
|
|
|
$this->updatedAs = $updatedAs; |
952
|
|
|
|
953
|
|
|
return $this; |
954
|
|
|
} |
955
|
|
|
|
956
|
|
|
/** |
957
|
|
|
* Returns the value of field updated_as |
958
|
|
|
* |
959
|
|
|
* @return integer |
960
|
|
|
*/ |
961
|
|
|
public function getUpdatedAs() |
962
|
|
|
{ |
963
|
|
|
return $this->updatedAs; |
964
|
|
|
} |
965
|
|
|
|
966
|
|
|
/** |
967
|
|
|
* Method to set the value of field deleted_at |
968
|
|
|
* |
969
|
|
|
* @param string $deletedAt |
970
|
|
|
* @return $this |
971
|
|
|
*/ |
972
|
|
|
public function setDeletedAt($deletedAt) |
973
|
|
|
{ |
974
|
|
|
$this->deletedAt = $deletedAt; |
975
|
|
|
|
976
|
|
|
return $this; |
977
|
|
|
} |
978
|
|
|
|
979
|
|
|
/** |
980
|
|
|
* Returns the value of field deleted_at |
981
|
|
|
* |
982
|
|
|
* @return string |
983
|
|
|
*/ |
984
|
|
|
public function getDeletedAt() |
985
|
|
|
{ |
986
|
|
|
return $this->deletedAt; |
987
|
|
|
} |
988
|
|
|
|
989
|
|
|
/** |
990
|
|
|
* Method to set the value of field deleted_as |
991
|
|
|
* |
992
|
|
|
* @param integer $deletedAs |
993
|
|
|
* @return $this |
994
|
|
|
*/ |
995
|
|
|
public function setDeletedAs($deletedAs) |
996
|
|
|
{ |
997
|
|
|
$this->deletedAs = $deletedAs; |
998
|
|
|
|
999
|
|
|
return $this; |
1000
|
|
|
} |
1001
|
|
|
|
1002
|
|
|
/** |
1003
|
|
|
* Returns the value of field deleted_as |
1004
|
|
|
* |
1005
|
|
|
* @return integer |
1006
|
|
|
*/ |
1007
|
|
|
public function getDeletedAs() |
1008
|
|
|
{ |
1009
|
|
|
return $this->deletedAs; |
1010
|
|
|
} |
1011
|
|
|
|
1012
|
|
|
/** |
1013
|
|
|
* Method to set the value of field deleted_by |
1014
|
|
|
* |
1015
|
|
|
* @param integer $deletedBy |
1016
|
|
|
* @return $this |
1017
|
|
|
*/ |
1018
|
|
|
public function setDeletedBy($deletedBy) |
1019
|
|
|
{ |
1020
|
|
|
$this->deletedBy = $deletedBy; |
1021
|
|
|
|
1022
|
|
|
return $this; |
1023
|
|
|
} |
1024
|
|
|
|
1025
|
|
|
/** |
1026
|
|
|
* Returns the value of field deleted_by |
1027
|
|
|
* |
1028
|
|
|
* @return integer |
1029
|
|
|
*/ |
1030
|
|
|
public function getDeletedBy() |
1031
|
|
|
{ |
1032
|
|
|
return $this->deletedBy; |
1033
|
|
|
} |
1034
|
|
|
|
1035
|
|
|
/** |
1036
|
|
|
* Method to set the value of field restored_at |
1037
|
|
|
* |
1038
|
|
|
* @param string $restoredAt |
1039
|
|
|
* @return $this |
1040
|
|
|
*/ |
1041
|
|
|
public function setRestoredAt($restoredAt) |
1042
|
|
|
{ |
1043
|
|
|
$this->restoredAt = $restoredAt; |
1044
|
|
|
|
1045
|
|
|
return $this; |
1046
|
|
|
} |
1047
|
|
|
|
1048
|
|
|
/** |
1049
|
|
|
* Returns the value of field restored_at |
1050
|
|
|
* |
1051
|
|
|
* @return string |
1052
|
|
|
*/ |
1053
|
|
|
public function getRestoredAt() |
1054
|
|
|
{ |
1055
|
|
|
return $this->restoredAt; |
1056
|
|
|
} |
1057
|
|
|
|
1058
|
|
|
/** |
1059
|
|
|
* Method to set the value of field restored_by |
1060
|
|
|
* |
1061
|
|
|
* @param integer $restoredBy |
1062
|
|
|
* @return $this |
1063
|
|
|
*/ |
1064
|
|
|
public function setRestoredBy($restoredBy) |
1065
|
|
|
{ |
1066
|
|
|
$this->restoredBy = $restoredBy; |
1067
|
|
|
|
1068
|
|
|
return $this; |
1069
|
|
|
} |
1070
|
|
|
|
1071
|
|
|
/** |
1072
|
|
|
* Returns the value of field restored_by |
1073
|
|
|
* |
1074
|
|
|
* @return integer |
1075
|
|
|
*/ |
1076
|
|
|
public function getRestoredBy() |
1077
|
|
|
{ |
1078
|
|
|
return $this->restoredBy; |
1079
|
|
|
} |
1080
|
|
|
|
1081
|
|
|
/** |
1082
|
|
|
* Method to set the value of field restored_as |
1083
|
|
|
* |
1084
|
|
|
* @param integer $restoredAs |
1085
|
|
|
* @return $this |
1086
|
|
|
*/ |
1087
|
|
|
public function setRestoredAs($restoredAs) |
1088
|
|
|
{ |
1089
|
|
|
$this->restoredAs = $restoredAs; |
1090
|
|
|
|
1091
|
|
|
return $this; |
1092
|
|
|
} |
1093
|
|
|
|
1094
|
|
|
/** |
1095
|
|
|
* Returns the value of field restored_as |
1096
|
|
|
* |
1097
|
|
|
* @return integer |
1098
|
|
|
*/ |
1099
|
|
|
public function getRestoredAs() |
1100
|
|
|
{ |
1101
|
|
|
return $this->restoredAs; |
1102
|
|
|
} |
1103
|
|
|
|
1104
|
|
|
/** |
1105
|
|
|
* Validations and business logic |
1106
|
|
|
* |
1107
|
|
|
* @return bool |
1108
|
|
|
*/ |
1109
|
|
|
public function validation(): bool |
1110
|
|
|
{ |
1111
|
|
|
$validator = new Validation(); |
1112
|
|
|
$validator->add('email', new EmailValidator([ |
1113
|
|
|
'model' => $this, |
1114
|
|
|
'message' => 'Please enter a correct email address', |
1115
|
|
|
])); |
1116
|
|
|
return $this->validate($validator); |
1117
|
|
|
} |
1118
|
|
|
|
1119
|
|
|
/** |
1120
|
|
|
* Initialize method for model. |
1121
|
|
|
*/ |
1122
|
|
|
public function initialize(): void |
1123
|
|
|
{ |
1124
|
|
|
parent::initialize(); |
1125
|
|
|
// $this->setSchema('zemit_core'); |
1126
|
|
|
$this->setSource('user'); |
1127
|
|
|
} |
1128
|
|
|
|
1129
|
|
|
/** |
1130
|
|
|
* Allows to query a set of records that match the specified conditions |
1131
|
|
|
* |
1132
|
|
|
* @param mixed $parameters |
1133
|
|
|
* @return AbstractUser[]|AbstractUser|ResultsetInterface |
1134
|
|
|
*/ |
1135
|
|
|
public static function find($parameters = null): ResultsetInterface |
1136
|
|
|
{ |
1137
|
|
|
return parent::find($parameters); |
1138
|
|
|
} |
1139
|
|
|
|
1140
|
|
|
/** |
1141
|
|
|
* Allows to query the first record that match the specified conditions |
1142
|
|
|
* |
1143
|
|
|
* @param mixed $parameters |
1144
|
|
|
* @return AbstractUser|ResultInterface|ModelInterface|null |
1145
|
|
|
*/ |
1146
|
|
|
public static function findFirst($parameters = null): ?ModelInterface |
1147
|
|
|
{ |
1148
|
|
|
return parent::findFirst($parameters); |
1149
|
|
|
} |
1150
|
|
|
|
1151
|
|
|
/** |
1152
|
|
|
* Independent Column Mapping. |
1153
|
|
|
* Keys are the real names in the table and the values their names in the application |
1154
|
|
|
* |
1155
|
|
|
* @return array |
1156
|
|
|
*/ |
1157
|
|
|
public function columnMap() |
1158
|
|
|
{ |
1159
|
|
|
return [ |
1160
|
|
|
'id' => 'id', |
1161
|
|
|
'email' => 'email', |
1162
|
|
|
'username' => 'username', |
1163
|
|
|
'mfa' => 'mfa', |
1164
|
|
|
'mfa_secret' => 'mfaSecret', |
1165
|
|
|
'token' => 'token', |
1166
|
|
|
'password' => 'password', |
1167
|
|
|
'password_confirm' => 'passwordConfirm', |
1168
|
|
|
'salt' => 'salt', |
1169
|
|
|
'first_name' => 'firstName', |
1170
|
|
|
'last_name' => 'lastName', |
1171
|
|
|
'gender' => 'gender', |
1172
|
|
|
'dob' => 'dob', |
1173
|
|
|
'title' => 'title', |
1174
|
|
|
'phone' => 'phone', |
1175
|
|
|
'phone2' => 'phone2', |
1176
|
|
|
'cellphone' => 'cellphone', |
1177
|
|
|
'fax' => 'fax', |
1178
|
|
|
'status' => 'status', |
1179
|
|
|
'category' => 'category', |
1180
|
|
|
'language' => 'language', |
1181
|
|
|
'newsletter' => 'newsletter', |
1182
|
|
|
'company_id' => 'companyId', |
1183
|
|
|
'deleted' => 'deleted', |
1184
|
|
|
'created_at' => 'createdAt', |
1185
|
|
|
'created_by' => 'createdBy', |
1186
|
|
|
'created_as' => 'createdAs', |
1187
|
|
|
'updated_at' => 'updatedAt', |
1188
|
|
|
'updated_by' => 'updatedBy', |
1189
|
|
|
'updated_as' => 'updatedAs', |
1190
|
|
|
'deleted_at' => 'deletedAt', |
1191
|
|
|
'deleted_as' => 'deletedAs', |
1192
|
|
|
'deleted_by' => 'deletedBy', |
1193
|
|
|
'restored_at' => 'restoredAt', |
1194
|
|
|
'restored_by' => 'restoredBy', |
1195
|
|
|
'restored_as' => 'restoredAs', |
1196
|
|
|
]; |
1197
|
|
|
} |
1198
|
|
|
} |
1199
|
|
|
|