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

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