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