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

AbstractAuditDetail::columnMap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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