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

CustomerWithConstructor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 15
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getTableName() 0 3 1
A getProfileQuery() 0 3 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
use Yiisoft\Aliases\Aliases;
10
use Yiisoft\Db\Connection\ConnectionInterface;
11
12
/**
13
 * CustomerWithConstructor.
14
 *
15
 * @property int $id
16
 * @property string $name
17
 * @property string $email
18
 * @property string $address
19
 * @property int $status
20
 * @property ProfileWithConstructor $profile
21
 */
22
final class CustomerWithConstructor extends ActiveRecord
23
{
24
    public function __construct(ConnectionInterface $db, private Aliases $aliases)
25
    {
26
        parent::__construct($db);
27
    }
28
29
    public function getTableName(): string
30
    {
31
        return 'customer';
32
    }
33
34
    public function getProfileQuery(): ActiveQuery
35
    {
36
        return $this->hasOne(Profile::class, ['id' => 'profile_id']);
37
    }
38
}
39