Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 14 |
CRAP | |
0.00% |
0 / 1 |
SolvPerson | |
0.00% |
0 / 18 |
|
0.00% |
0 / 14 |
272 | |
0.00% |
0 / 1 |
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSameAs | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setSameAs | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getBirthYear | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setBirthYear | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDomicile | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setDomicile | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getMember | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setMember | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getFieldValue | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
setFieldValue | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace Olz\Entity; |
4 | |
5 | use Doctrine\ORM\Mapping as ORM; |
6 | use Olz\Repository\SolvPersonRepository; |
7 | |
8 | #[ORM\Table(name: 'solv_people')] |
9 | #[ORM\Index(name: 'same_as_index', columns: ['same_as'])] |
10 | #[ORM\Entity(repositoryClass: SolvPersonRepository::class)] |
11 | class SolvPerson { |
12 | #[ORM\Id] |
13 | #[ORM\Column(type: 'integer', nullable: false)] |
14 | #[ORM\GeneratedValue] |
15 | private int $id; |
16 | |
17 | #[ORM\Column(type: 'integer', nullable: true)] |
18 | private ?int $same_as; |
19 | |
20 | #[ORM\Column(type: 'text', nullable: false)] |
21 | private string $name; |
22 | |
23 | #[ORM\Column(type: 'text', nullable: false)] |
24 | private string $birth_year; |
25 | |
26 | #[ORM\Column(type: 'text', nullable: false)] |
27 | private string $domicile; |
28 | |
29 | #[ORM\Column(type: 'integer', nullable: false)] |
30 | private int $member; |
31 | |
32 | /** @var array<string, true> */ |
33 | private array $valid_field_names = [ |
34 | 'id' => true, |
35 | 'same_as' => true, |
36 | 'name' => true, |
37 | 'birth_year' => true, |
38 | 'domicile' => true, |
39 | 'member' => true, |
40 | ]; |
41 | // PRIMARY KEY (`id`) |
42 | |
43 | public function getId(): ?int { |
44 | return $this->id ?? null; |
45 | } |
46 | |
47 | public function setId(int $new_id): void { |
48 | $this->id = $new_id; |
49 | } |
50 | |
51 | public function getSameAs(): ?int { |
52 | return $this->same_as; |
53 | } |
54 | |
55 | public function setSameAs(?int $new_same_as): void { |
56 | $this->same_as = $new_same_as; |
57 | } |
58 | |
59 | public function getName(): string { |
60 | return $this->name; |
61 | } |
62 | |
63 | public function setName(string $new_name): void { |
64 | $this->name = $new_name; |
65 | } |
66 | |
67 | public function getBirthYear(): string { |
68 | return $this->birth_year; |
69 | } |
70 | |
71 | public function setBirthYear(string $new_birth_year): void { |
72 | $this->birth_year = $new_birth_year; |
73 | } |
74 | |
75 | public function getDomicile(): string { |
76 | return $this->domicile; |
77 | } |
78 | |
79 | public function setDomicile(string $new_domicile): void { |
80 | $this->domicile = $new_domicile; |
81 | } |
82 | |
83 | public function getMember(): int { |
84 | return $this->member; |
85 | } |
86 | |
87 | public function setMember(int $new_member): void { |
88 | $this->member = $new_member; |
89 | } |
90 | |
91 | public function getFieldValue(string $field_name): mixed { |
92 | if (!isset($this->valid_field_names[$field_name])) { |
93 | throw new \Exception("getFieldValue: Invalid field name: {$field_name}", 1); |
94 | } |
95 | return $this->{$field_name}; |
96 | } |
97 | |
98 | public function setFieldValue(string $field_name, mixed $new_field_value): void { |
99 | if (!isset($this->valid_field_names[$field_name])) { |
100 | throw new \Exception("setFieldValue: Invalid field name: {$field_name}", 1); |
101 | } |
102 | $this->{$field_name} = $new_field_value; |
103 | } |
104 | } |