Test Failed
Push — master ( ce60e5...378563 )
by Julien
12:41 queued 07:49
created

AbstractUser::setUuid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
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\Filter\Validation;
44
use Phalcon\Filter\Validation\Validator\Email as EmailValidator;
45
46
/**
47
 * AbstractUser
48
 * 
49
 * @package Zemit\Models\Abstracts
50
 * @autogenerated by Phalcon Developer Tools
51
 * @date 2024-02-29, 19:46:11
52
 */
53
abstract class AbstractUser extends \Zemit\Models\AbstractModel
54
{
55
56
    /**
57
     *
58
     * @var integer
59
     */
60
    protected $id;
61
62
    /**
63
     *
64
     * @var integer
65
     */
66
    protected $uuid;
67
68
    /**
69
     *
70
     * @var string
71
     */
72
    protected $email;
73
74
    /**
75
     *
76
     * @var string
77
     */
78
    protected $password;
79
80
    /**
81
     *
82
     * @var integer
83
     */
84
    protected $deleted;
85
86
    /**
87
     *
88
     * @var string
89
     */
90
    protected $createdAt;
91
92
    /**
93
     *
94
     * @var integer
95
     */
96
    protected $createdBy;
97
98
    /**
99
     *
100
     * @var integer
101
     */
102
    protected $createdAs;
103
104
    /**
105
     *
106
     * @var string
107
     */
108
    protected $updatedAt;
109
110
    /**
111
     *
112
     * @var integer
113
     */
114
    protected $updatedBy;
115
116
    /**
117
     *
118
     * @var integer
119
     */
120
    protected $updatedAs;
121
122
    /**
123
     *
124
     * @var string
125
     */
126
    protected $deletedAt;
127
128
    /**
129
     *
130
     * @var integer
131
     */
132
    protected $deletedAs;
133
134
    /**
135
     *
136
     * @var integer
137
     */
138
    protected $deletedBy;
139
140
    /**
141
     *
142
     * @var string
143
     */
144
    protected $restoredAt;
145
146
    /**
147
     *
148
     * @var integer
149
     */
150
    protected $restoredBy;
151
152
    /**
153
     *
154
     * @var integer
155
     */
156
    protected $restoredAs;
157
158
    /**
159
     * Method to set the value of field id
160
     *
161
     * @param integer $id
162
     * @return $this
163
     */
164
    public function setId($id)
165
    {
166
        $this->id = $id;
167
168
        return $this;
169
    }
170
171
    /**
172
     * Method to set the value of field uuid
173
     *
174
     * @param integer $uuid
175
     * @return $this
176
     */
177
    public function setUuid($uuid)
178
    {
179
        $this->uuid = $uuid;
180
181
        return $this;
182
    }
183
184
    /**
185
     * Method to set the value of field email
186
     *
187
     * @param string $email
188
     * @return $this
189
     */
190 2
    public function setEmail($email)
191
    {
192 2
        $this->email = $email;
193
194 2
        return $this;
195
    }
196
197
    /**
198
     * Method to set the value of field password
199
     *
200
     * @param string $password
201
     * @return $this
202
     */
203
    public function setPassword($password)
204
    {
205
        $this->password = $password;
206
207
        return $this;
208
    }
209
210
    /**
211
     * Method to set the value of field deleted
212
     *
213
     * @param integer $deleted
214
     * @return $this
215
     */
216
    public function setDeleted($deleted)
217
    {
218
        $this->deleted = $deleted;
219
220
        return $this;
221
    }
222
223
    /**
224
     * Method to set the value of field created_at
225
     *
226
     * @param string $createdAt
227
     * @return $this
228
     */
229
    public function setCreatedAt($createdAt)
230
    {
231
        $this->createdAt = $createdAt;
232
233
        return $this;
234
    }
235
236
    /**
237
     * Method to set the value of field created_by
238
     *
239
     * @param integer $createdBy
240
     * @return $this
241
     */
242
    public function setCreatedBy($createdBy)
243
    {
244
        $this->createdBy = $createdBy;
245
246
        return $this;
247
    }
248
249
    /**
250
     * Method to set the value of field created_as
251
     *
252
     * @param integer $createdAs
253
     * @return $this
254
     */
255
    public function setCreatedAs($createdAs)
256
    {
257
        $this->createdAs = $createdAs;
258
259
        return $this;
260
    }
261
262
    /**
263
     * Method to set the value of field updated_at
264
     *
265
     * @param string $updatedAt
266
     * @return $this
267
     */
268
    public function setUpdatedAt($updatedAt)
269
    {
270
        $this->updatedAt = $updatedAt;
271
272
        return $this;
273
    }
274
275
    /**
276
     * Method to set the value of field updated_by
277
     *
278
     * @param integer $updatedBy
279
     * @return $this
280
     */
281
    public function setUpdatedBy($updatedBy)
282
    {
283
        $this->updatedBy = $updatedBy;
284
285
        return $this;
286
    }
287
288
    /**
289
     * Method to set the value of field updated_as
290
     *
291
     * @param integer $updatedAs
292
     * @return $this
293
     */
294
    public function setUpdatedAs($updatedAs)
295
    {
296
        $this->updatedAs = $updatedAs;
297
298
        return $this;
299
    }
300
301
    /**
302
     * Method to set the value of field deleted_at
303
     *
304
     * @param string $deletedAt
305
     * @return $this
306
     */
307
    public function setDeletedAt($deletedAt)
308
    {
309
        $this->deletedAt = $deletedAt;
310
311
        return $this;
312
    }
313
314
    /**
315
     * Method to set the value of field deleted_as
316
     *
317
     * @param integer $deletedAs
318
     * @return $this
319
     */
320
    public function setDeletedAs($deletedAs)
321
    {
322
        $this->deletedAs = $deletedAs;
323
324
        return $this;
325
    }
326
327
    /**
328
     * Method to set the value of field deleted_by
329
     *
330
     * @param integer $deletedBy
331
     * @return $this
332
     */
333
    public function setDeletedBy($deletedBy)
334
    {
335
        $this->deletedBy = $deletedBy;
336
337
        return $this;
338
    }
339
340
    /**
341
     * Method to set the value of field restored_at
342
     *
343
     * @param string $restoredAt
344
     * @return $this
345
     */
346
    public function setRestoredAt($restoredAt)
347
    {
348
        $this->restoredAt = $restoredAt;
349
350
        return $this;
351
    }
352
353
    /**
354
     * Method to set the value of field restored_by
355
     *
356
     * @param integer $restoredBy
357
     * @return $this
358
     */
359
    public function setRestoredBy($restoredBy)
360
    {
361
        $this->restoredBy = $restoredBy;
362
363
        return $this;
364
    }
365
366
    /**
367
     * Method to set the value of field restored_as
368
     *
369
     * @param integer $restoredAs
370
     * @return $this
371
     */
372
    public function setRestoredAs($restoredAs)
373
    {
374
        $this->restoredAs = $restoredAs;
375
376
        return $this;
377
    }
378
379
    /**
380
     * Returns the value of field id
381
     *
382
     * @return integer
383
     */
384 1
    public function getId()
385
    {
386 1
        return $this->id;
387
    }
388
389
    /**
390
     * Returns the value of field uuid
391
     *
392
     * @return integer
393
     */
394
    public function getUuid()
395
    {
396
        return $this->uuid;
397
    }
398
399
    /**
400
     * Returns the value of field email
401
     *
402
     * @return string
403
     */
404 1
    public function getEmail()
405
    {
406 1
        return $this->email;
407
    }
408
409
    /**
410
     * Returns the value of field password
411
     *
412
     * @return string
413
     */
414
    public function getPassword()
415
    {
416
        return $this->password;
417
    }
418
419
    /**
420
     * Returns the value of field deleted
421
     *
422
     * @return integer
423
     */
424 1
    public function getDeleted()
425
    {
426 1
        return $this->deleted;
427
    }
428
429
    /**
430
     * Returns the value of field createdAt
431
     *
432
     * @return string
433
     */
434
    public function getCreatedAt()
435
    {
436
        return $this->createdAt;
437
    }
438
439
    /**
440
     * Returns the value of field createdBy
441
     *
442
     * @return integer
443
     */
444 1
    public function getCreatedBy()
445
    {
446 1
        return $this->createdBy;
447
    }
448
449
    /**
450
     * Returns the value of field createdAs
451
     *
452
     * @return integer
453
     */
454
    public function getCreatedAs()
455
    {
456
        return $this->createdAs;
457
    }
458
459
    /**
460
     * Returns the value of field updatedAt
461
     *
462
     * @return string
463
     */
464
    public function getUpdatedAt()
465
    {
466
        return $this->updatedAt;
467
    }
468
469
    /**
470
     * Returns the value of field updatedBy
471
     *
472
     * @return integer
473
     */
474 1
    public function getUpdatedBy()
475
    {
476 1
        return $this->updatedBy;
477
    }
478
479
    /**
480
     * Returns the value of field updatedAs
481
     *
482
     * @return integer
483
     */
484
    public function getUpdatedAs()
485
    {
486
        return $this->updatedAs;
487
    }
488
489
    /**
490
     * Returns the value of field deletedAt
491
     *
492
     * @return string
493
     */
494
    public function getDeletedAt()
495
    {
496
        return $this->deletedAt;
497
    }
498
499
    /**
500
     * Returns the value of field deletedAs
501
     *
502
     * @return integer
503
     */
504
    public function getDeletedAs()
505
    {
506
        return $this->deletedAs;
507
    }
508
509
    /**
510
     * Returns the value of field deletedBy
511
     *
512
     * @return integer
513
     */
514 1
    public function getDeletedBy()
515
    {
516 1
        return $this->deletedBy;
517
    }
518
519
    /**
520
     * Returns the value of field restoredAt
521
     *
522
     * @return string
523
     */
524
    public function getRestoredAt()
525
    {
526
        return $this->restoredAt;
527
    }
528
529
    /**
530
     * Returns the value of field restoredBy
531
     *
532
     * @return integer
533
     */
534 1
    public function getRestoredBy()
535
    {
536 1
        return $this->restoredBy;
537
    }
538
539
    /**
540
     * Returns the value of field restoredAs
541
     *
542
     * @return integer
543
     */
544
    public function getRestoredAs()
545
    {
546
        return $this->restoredAs;
547
    }
548
549
    /**
550
     * Validations and business logic
551
     *
552
     * @return boolean
553
     */
554
    public function validation()
555
    {
556
        $validator = new Validation();
557
558
        $validator->add(
559
            'email',
560
            new EmailValidator(
561
                [
562
                    'model'   => $this,
563
                    'message' => 'Please enter a correct email address',
564
                ]
565
            )
566
        );
567
568
        return $this->validate($validator);
569
    }
570
571
    /**
572
     * Initialize method for model.
573
     */
574 2
    public function initialize() :void
575
    {
576 2
        parent::initialize();
577
        // $this->setSchema("zemit_core");
578 2
        $this->setSource("user");
579
    }
580
581
    /**
582
     * Allows to query a set of records that match the specified conditions
583
     *
584
     * @param mixed $parameters
585
     * @return AbstractUser[]|AbstractUser|\Phalcon\Mvc\Model\ResultSetInterface
586
     */
587
    public static function find($parameters = null): \Phalcon\Mvc\Model\ResultsetInterface
588
    {
589
        return parent::find($parameters);
590
    }
591
592
    /**
593
     * Allows to query the first record that match the specified conditions
594
     *
595
     * @param mixed $parameters
596
     * @return AbstractUser|\Phalcon\Mvc\Model\ResultInterface|\Phalcon\Mvc\ModelInterface|null
597
     */
598
    public static function findFirst($parameters = null): ?\Phalcon\Mvc\ModelInterface
599
    {
600
        return parent::findFirst($parameters);
601
    }
602
603
    /**
604
     * Independent Column Mapping.
605
     * Keys are the real names in the table and the values their names in the application
606
     *
607
     * @return array
608
     */
609 2
    public function columnMap()
610
    {
611 2
        return [
612 2
            'id' => 'id',
613 2
            'uuid' => 'uuid',
614 2
            'email' => 'email',
615 2
            'password' => 'password',
616 2
            'deleted' => 'deleted',
617 2
            'created_at' => 'createdAt',
618 2
            'created_by' => 'createdBy',
619 2
            'created_as' => 'createdAs',
620 2
            'updated_at' => 'updatedAt',
621 2
            'updated_by' => 'updatedBy',
622 2
            'updated_as' => 'updatedAs',
623 2
            'deleted_at' => 'deletedAt',
624 2
            'deleted_as' => 'deletedAs',
625 2
            'deleted_by' => 'deletedBy',
626 2
            'restored_at' => 'restoredAt',
627 2
            'restored_by' => 'restoredBy',
628 2
            'restored_as' => 'restoredAs'
629 2
        ];
630
    }
631
632
}
633