Passed
Pull Request — master (#42)
by Rafael
05:35
created

SystemModules::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 38
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 27
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 26
nc 1
nop 0
dl 0
loc 38
ccs 27
cts 27
cp 1
crap 1
rs 9.504
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Gewaer\Models;
5
6
class SystemModules extends AbstractModel
7
{
8
    /**
9
     *
10
     * @var integer
11
     */
12
    public $id;
13
14
    /**
15
     *
16
     * @var integer
17
     */
18
    public $name;
19
20
    /**
21
     *
22
     * @var integer
23
     */
24
    public $slug;
25
26
    /**
27
     *
28
     * @var string
29
     */
30
    public $model_name;
31
32
    /**
33
     *
34
     * @var integer
35
     */
36
    public $apps_id;
37
38
    /**
39
     *
40
     * @var integer
41
     */
42
    public $parents_id;
43
44
    /**
45
     *
46
     * @var integer
47
     */
48
    public $menu_order;
49
50
    /**
51
     *
52
     * @var string
53
     */
54
    public $created_at;
55
56
    /**
57
     *
58
     * @var string
59
     */
60
    public $updated_at;
61
62
    /**
63
     *
64
     * @var integer
65
     */
66
    public $is_deleted;
67
68
    /**
69
     * Initialize method for model.
70
     */
71 65
    public function initialize()
72
    {
73 65
        $this->hasMany(
74 65
            'id',
75 65
            'Gewaer\Models\EmailTemplatesVariables',
76 65
            'system_modules_id',
77 65
            ['alias' => 'templateVariable']
78
        );
79
80 65
        $this->hasMany(
81 65
            'id',
82 65
            'Gewaer\Models\Webhooks',
83 65
            'system_modules_id',
84 65
            ['alias' => 'webhook']
85
        );
86
87 65
        $this->belongsTo(
88 65
            'companies_id',
89 65
            'Gewaer\Models\Companies',
90 65
            'id',
91 65
            ['alias' => 'company']
92
        );
93
94 65
        $this->belongsTo(
95 65
            'apps_id',
96 65
            'Gewaer\Models\Apps',
97 65
            'id',
98 65
            ['alias' => 'app']
99
        );
100
101 65
        $this->belongsTo(
102 65
            'company_branches_id',
103 65
            'Gewaer\Models\CompanyBranches',
104 65
            'id',
105 65
            ['alias' => 'companyBranch']
106
        );
107
108 65
        $this->setSource('user_company_apps_activities');
109 65
    }
110
111
    /**
112
     * Returns table name mapped in the model.
113
     *
114
     * @return string
115
     */
116 65
    public function getSource(): string
117
    {
118 65
        return 'system_modules';
119
    }
120
}
121