Passed
Pull Request — master (#329)
by Sergei
02:48
created

Dossier   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTableName() 0 3 1
A getEmployeeQuery() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord;
6
7
use Yiisoft\ActiveRecord\ActiveQuery;
8
use Yiisoft\ActiveRecord\ActiveRecord;
9
10
/**
11
 * Class Dossier
12
 *
13
 * @property int $id
14
 * @property int $department_id
15
 * @property int $employee_id
16
 * @property string $summary
17
 * @property Employee $employee
18
 */
19
final class Dossier extends ActiveRecord
20
{
21
    public function getTableName(): string
22
    {
23
        return 'dossier';
24
    }
25
26
    public function getEmployeeQuery(): ActiveQuery
27
    {
28
        return $this->hasOne(
29
            Employee::class,
30
            [
31
                'department_id' => 'department_id',
32
                'id' => 'employee_id',
33
            ]
34
        )->inverseOf('dossier');
35
    }
36
}
37