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

AbstractPost::columnMap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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