Total Complexity | 7 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | final class Item extends ActiveRecord |
||
15 | { |
||
16 | protected int $id; |
||
17 | protected string $name; |
||
18 | protected int $category_id; |
||
19 | |||
20 | public function getTableName(): string |
||
21 | { |
||
22 | return 'item'; |
||
23 | } |
||
24 | |||
25 | public function relationQuery(string $name): ActiveQueryInterface |
||
26 | { |
||
27 | return match ($name) { |
||
28 | 'category' => $this->getCategoryQuery(), |
||
29 | default => parent::relationQuery($name), |
||
30 | }; |
||
31 | } |
||
32 | |||
33 | public function getId(): int |
||
34 | { |
||
35 | return $this->id; |
||
36 | } |
||
37 | |||
38 | public function getName(): string |
||
39 | { |
||
40 | return $this->name; |
||
41 | } |
||
42 | |||
43 | public function getCategoryId(): int |
||
44 | { |
||
45 | return $this->category_id; |
||
46 | } |
||
47 | |||
48 | public function getCategory(): Category |
||
49 | { |
||
50 | return $this->relation('category'); |
||
|
|||
51 | } |
||
52 | |||
53 | public function getCategoryQuery(): ActiveQuery |
||
56 | } |
||
57 | } |
||
58 |