Passed
Pull Request — master (#54)
by Rafael
06:51
created

UserRoles   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 30
dl 0
loc 88
ccs 25
cts 25
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 30 1
A getSource() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Gewaer\Models;
5
6
class UserRoles extends AbstractModel
7
{
8
    /**
9
     *
10
     * @var integer
11
     */
12
    public $users_id;
13
14
    /**
15
     *
16
     * @var integer
17
     */
18
    public $apps_id;
19
20
    /**
21
     *
22
     * @var integer
23
     */
24
    public $roles_id;
25
26
    /**
27
     *
28
     * @var integer
29
     */
30
    public $companies_id;
31
32
    /**
33
     *
34
     * @var string
35
     */
36
    public $created_at;
37
38
    /**
39
     *
40
     * @var string
41
     */
42
    public $updated_at;
43
44
    /**
45
     *
46
     * @var integer
47
     */
48
    public $is_deleted;
49
50
    /**
51
     * Initialize method for model.
52
     */
53 7
    public function initialize()
54
    {
55 7
        $this->setSource('user_roles');
56
57 7
        $this->belongsTo(
58 7
            'users_id',
59 7
            'Gewaer\Models\Users',
60 7
            'id',
61 7
            ['alias' => 'user']
62
        );
63
64 7
        $this->belongsTo(
65 7
            'roles_id',
66 7
            'Gewaer\Models\Roles',
67 7
            'id',
68 7
            ['alias' => 'roles']
69
        );
70
71 7
        $this->belongsTo(
72 7
            'apps_id',
73 7
            'Gewaer\Models\Apps',
74 7
            'id',
75 7
            ['alias' => 'app']
76
        );
77
78 7
        $this->belongsTo(
79 7
            'companies_id',
80 7
            'Gewaer\Models\Companies',
81 7
            'id',
82 7
            ['alias' => 'company']
83
        );
84 7
    }
85
86
    /**
87
     * Returns table name mapped in the model.
88
     *
89
     * @return string
90
     */
91 7
    public function getSource(): string
92
    {
93 7
        return 'user_roles';
94
    }
95
}
96