Passed
Push — develop ( aa0db1...06f5e3 )
by Портнов
11:38
created

OutWorkTimesRouts::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 26
rs 9.6666
cc 1
nc 1
nop 0
1
<?php
2
/*
3
 * MikoPBX - free phone system for small business
4
 * Copyright (C) 2017-2020 Alexey Portnov and Nikolay Beketov
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License along with this program.
17
 * If not, see <https://www.gnu.org/licenses/>.
18
 */
19
20
namespace MikoPBX\Common\Models;
21
22
use Phalcon\Mvc\Model\Relation;
23
24
/**
25
 * Class OutWorkTimes
26
 *
27
 * @package MikoPBX\Common\Models
28
 */
29
class OutWorkTimesRouts extends ModelsBase
30
{
31
    /**
32
     * @Primary
33
     * @Identity
34
     * @Column(type="integer", nullable=false)
35
     */
36
    public $id;
37
38
    /**
39
     * @Column(type="integer", nullable=false)
40
     */
41
    public $timeConditionId;
42
43
    /**
44
     * @Column(type="integer", nullable=false)
45
     */
46
    public $routId;
47
48
    public function initialize(): void
49
    {
50
        $this->setSource('m_OutWorkTimesRouts');
51
        parent::initialize();
52
        $this->belongsTo(
53
            'timeConditionId',
54
            OutWorkTimes::class,
55
            'id',
56
            [
57
                'alias'      => 'OutWorkTimes',
58
                'foreignKey' => [
59
                    'allowNulls' => false,
60
                    'action'     => Relation::NO_ACTION,
61
                ],
62
            ]
63
        );
64
65
        $this->hasOne(
66
            'routId',
67
            IncomingRoutingTable::class,
68
            'id',
69
            [
70
                'alias'      => 'IncomingRoutingTable',
71
                'foreignKey' => [
72
                    'allowNulls' => false,
73
                    'action'     => Relation::NO_ACTION,
74
                ],
75
            ]
76
        );
77
    }
78
}
79
80