Failed Conditions
Push — master ( 55bfad...b74acd )
by Maximo
02:48
created

CustomFields::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 17
CRAP Score 1

Importance

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