Test Failed
Pull Request — master (#54)
by Rafael
05:26
created

CompaniesCustomFields::getSource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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