Passed
Push — master ( bc8b6f...7a9b1f )
by Sergei
02:57
created

CustomerWithConstructor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getProfileQuery() 0 3 1
A getTableName() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\ActiveRecord\Tests\Stubs\MagicActiveRecord;
6
7
use Yiisoft\ActiveRecord\ActiveQuery;
8
use Yiisoft\ActiveRecord\Tests\Stubs\MagicActiveRecord;
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 MagicActiveRecord
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