Test Failed
Push — master ( 35ab15...7ed30e )
by Julien
04:21
created

AbstractSession::columnMap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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