Total Complexity | 12 |
Total Lines | 65 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | class CustomerWithProperties extends MagicActiveRecord |
||
14 | { |
||
15 | protected int $id; |
||
16 | protected string $email; |
||
17 | protected string|null $name = null; |
||
18 | public string|null $address = null; |
||
19 | |||
20 | public function getTableName(): string |
||
21 | { |
||
22 | return 'customer'; |
||
23 | } |
||
24 | |||
25 | public function getId(): int |
||
26 | { |
||
27 | return $this->id; |
||
28 | } |
||
29 | |||
30 | public function getEmail(): string |
||
31 | { |
||
32 | return $this->email; |
||
33 | } |
||
34 | |||
35 | public function getName(): string|null |
||
36 | { |
||
37 | return $this->name; |
||
38 | } |
||
39 | |||
40 | public function getAddress(): string|null |
||
41 | { |
||
42 | return $this->address; |
||
43 | } |
||
44 | |||
45 | public function getStatus(): int|null |
||
46 | { |
||
47 | return $this->getAttribute('status'); |
||
48 | } |
||
49 | |||
50 | public function getProfileQuery(): ActiveQuery |
||
51 | { |
||
52 | return $this->hasOne(Profile::class, ['id' => 'profile_id']); |
||
53 | } |
||
54 | |||
55 | public function getOrdersQuery(): ActiveQuery |
||
56 | { |
||
57 | return $this->hasMany(Order::class, ['customer_id' => 'id'])->orderBy('[[id]]'); |
||
58 | } |
||
59 | |||
60 | public function setEmail(string $email): void |
||
63 | } |
||
64 | |||
65 | public function setName(string|null $name): void |
||
66 | { |
||
67 | $this->name = $name; |
||
68 | } |
||
69 | |||
70 | public function setAddress(string|null $address): void |
||
71 | { |
||
72 | $this->address = $address; |
||
73 | } |
||
74 | |||
75 | public function setStatus(int|null $status): void |
||
78 | } |
||
79 | } |
||
80 |