Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 50 |
|
0.00% |
0 / 36 |
CRAP | |
0.00% |
0 / 1 |
| SolvResult | |
0.00% |
0 / 50 |
|
0.00% |
0 / 36 |
1482 | |
0.00% |
0 / 1 |
| __toString | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |||
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getPerson | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setPerson | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getEvent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setEvent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getClass | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setClass | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getRank | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setRank | |
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 | |||
| getClub | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setClub | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getResult | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setResult | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getSplits | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setSplits | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getFinishSplit | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setFinishSplit | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getClassDistance | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setClassDistance | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getClassElevation | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setClassElevation | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getClassControlCount | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setClassControlCount | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getClassCompetitorCount | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setClassCompetitorCount | |
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\SolvResultRepository; |
| 8 | |
| 9 | #[ORM\Table(name: 'solv_results')] |
| 10 | #[ORM\Index(name: 'person_name_index', columns: ['person', 'name'])] |
| 11 | #[ORM\Index(name: 'event_index', columns: ['event'])] |
| 12 | #[ORM\Entity(repositoryClass: SolvResultRepository::class)] |
| 13 | class SolvResult implements TestableInterface { |
| 14 | #[ORM\Id] |
| 15 | #[ORM\Column(type: 'integer', nullable: false)] |
| 16 | #[ORM\GeneratedValue] |
| 17 | private int $id; |
| 18 | |
| 19 | #[ORM\Column(type: 'integer', nullable: false)] |
| 20 | private int $person; |
| 21 | |
| 22 | #[ORM\Column(type: 'integer', nullable: false)] |
| 23 | private int $event; |
| 24 | |
| 25 | #[ORM\Column(type: 'string', nullable: false, length: 15)] |
| 26 | private string $class; |
| 27 | |
| 28 | #[ORM\Column(type: 'integer', nullable: false)] |
| 29 | private int $rank; |
| 30 | |
| 31 | #[ORM\Column(type: 'string', nullable: false, length: 31)] |
| 32 | private string $name; |
| 33 | |
| 34 | #[ORM\Column(type: 'string', nullable: false, length: 3)] |
| 35 | private string $birth_year; |
| 36 | |
| 37 | #[ORM\Column(type: 'string', nullable: false, length: 31)] |
| 38 | private string $domicile; |
| 39 | |
| 40 | #[ORM\Column(type: 'string', nullable: false, length: 31)] |
| 41 | private string $club; |
| 42 | |
| 43 | #[ORM\Column(type: 'integer', nullable: false)] |
| 44 | private int $result; |
| 45 | |
| 46 | #[ORM\Column(type: 'text', nullable: false)] |
| 47 | private string $splits; |
| 48 | |
| 49 | #[ORM\Column(type: 'integer', nullable: false)] |
| 50 | private int $finish_split; |
| 51 | |
| 52 | #[ORM\Column(type: 'integer', nullable: false)] |
| 53 | private int $class_distance; |
| 54 | |
| 55 | #[ORM\Column(type: 'integer', nullable: false)] |
| 56 | private int $class_elevation; |
| 57 | |
| 58 | #[ORM\Column(type: 'integer', nullable: false)] |
| 59 | private int $class_control_count; |
| 60 | |
| 61 | #[ORM\Column(type: 'integer', nullable: false)] |
| 62 | private int $class_competitor_count; |
| 63 | |
| 64 | public function __toString(): string { |
| 65 | return <<<ZZZZZZZZZZ |
| 66 | SolvResult( |
| 67 | id:{$this->id}, |
| 68 | event:{$this->event}, |
| 69 | class:{$this->class}, |
| 70 | person:{$this->person}, |
| 71 | name:{$this->name}, |
| 72 | birth_year:{$this->birth_year}, |
| 73 | domicile:{$this->domicile}, |
| 74 | club:{$this->club}, |
| 75 | ) |
| 76 | ZZZZZZZZZZ; |
| 77 | } |
| 78 | |
| 79 | /** @var array<string, true> */ |
| 80 | private array $valid_field_names = [ |
| 81 | 'id' => true, |
| 82 | 'person' => true, |
| 83 | 'event' => true, |
| 84 | 'class' => true, |
| 85 | 'rank' => true, |
| 86 | 'name' => true, |
| 87 | 'birth_year' => true, |
| 88 | 'domicile' => true, |
| 89 | 'club' => true, |
| 90 | 'result' => true, |
| 91 | 'splits' => true, |
| 92 | 'finish_split' => true, |
| 93 | 'class_distance' => true, |
| 94 | 'class_elevation' => true, |
| 95 | 'class_control_count' => true, |
| 96 | 'class_competitor_count' => true, |
| 97 | ]; |
| 98 | // PRIMARY KEY (`id`), |
| 99 | // UNIQUE KEY `person` (`person`,`event`,`class`,`name`,`birth_year`,`domicile`,`club`) |
| 100 | |
| 101 | public function getId(): ?int { |
| 102 | return $this->id ?? null; |
| 103 | } |
| 104 | |
| 105 | public function setId(int $new_id): void { |
| 106 | $this->id = $new_id; |
| 107 | } |
| 108 | |
| 109 | public function getPerson(): int { |
| 110 | return $this->person; |
| 111 | } |
| 112 | |
| 113 | public function setPerson(int $new_person): void { |
| 114 | $this->person = $new_person; |
| 115 | } |
| 116 | |
| 117 | public function getEvent(): int { |
| 118 | return $this->event; |
| 119 | } |
| 120 | |
| 121 | public function setEvent(int $new_event): void { |
| 122 | $this->event = $new_event; |
| 123 | } |
| 124 | |
| 125 | public function getClass(): string { |
| 126 | return $this->class; |
| 127 | } |
| 128 | |
| 129 | public function setClass(string $new_class): void { |
| 130 | $this->class = $new_class; |
| 131 | } |
| 132 | |
| 133 | public function getRank(): int { |
| 134 | return $this->rank; |
| 135 | } |
| 136 | |
| 137 | public function setRank(int $new_rank): void { |
| 138 | $this->rank = $new_rank; |
| 139 | } |
| 140 | |
| 141 | public function getName(): string { |
| 142 | return $this->name; |
| 143 | } |
| 144 | |
| 145 | public function setName(string $new_name): void { |
| 146 | $this->name = $new_name; |
| 147 | } |
| 148 | |
| 149 | public function getBirthYear(): string { |
| 150 | return $this->birth_year; |
| 151 | } |
| 152 | |
| 153 | public function setBirthYear(string $new_birth_year): void { |
| 154 | $this->birth_year = $new_birth_year; |
| 155 | } |
| 156 | |
| 157 | public function getDomicile(): string { |
| 158 | return $this->domicile; |
| 159 | } |
| 160 | |
| 161 | public function setDomicile(string $new_domicile): void { |
| 162 | $this->domicile = $new_domicile; |
| 163 | } |
| 164 | |
| 165 | public function getClub(): string { |
| 166 | return $this->club; |
| 167 | } |
| 168 | |
| 169 | public function setClub(string $new_club): void { |
| 170 | $this->club = $new_club; |
| 171 | } |
| 172 | |
| 173 | public function getResult(): int { |
| 174 | return $this->result; |
| 175 | } |
| 176 | |
| 177 | public function setResult(int $new_result): void { |
| 178 | $this->result = $new_result; |
| 179 | } |
| 180 | |
| 181 | public function getSplits(): string { |
| 182 | return $this->splits; |
| 183 | } |
| 184 | |
| 185 | public function setSplits(string $new_splits): void { |
| 186 | $this->splits = $new_splits; |
| 187 | } |
| 188 | |
| 189 | public function getFinishSplit(): int { |
| 190 | return $this->finish_split; |
| 191 | } |
| 192 | |
| 193 | public function setFinishSplit(int $new_finish_split): void { |
| 194 | $this->finish_split = $new_finish_split; |
| 195 | } |
| 196 | |
| 197 | public function getClassDistance(): int { |
| 198 | return $this->class_distance; |
| 199 | } |
| 200 | |
| 201 | public function setClassDistance(int $new_class_distance): void { |
| 202 | $this->class_distance = $new_class_distance; |
| 203 | } |
| 204 | |
| 205 | public function getClassElevation(): int { |
| 206 | return $this->class_elevation; |
| 207 | } |
| 208 | |
| 209 | public function setClassElevation(int $new_class_elevation): void { |
| 210 | $this->class_elevation = $new_class_elevation; |
| 211 | } |
| 212 | |
| 213 | public function getClassControlCount(): int { |
| 214 | return $this->class_control_count; |
| 215 | } |
| 216 | |
| 217 | public function setClassControlCount(int $new_class_control_count): void { |
| 218 | $this->class_control_count = $new_class_control_count; |
| 219 | } |
| 220 | |
| 221 | public function getClassCompetitorCount(): int { |
| 222 | return $this->class_competitor_count; |
| 223 | } |
| 224 | |
| 225 | public function setClassCompetitorCount(int $new_class_competitor_count): void { |
| 226 | $this->class_competitor_count = $new_class_competitor_count; |
| 227 | } |
| 228 | |
| 229 | public function getFieldValue(string $field_name): mixed { |
| 230 | if (!isset($this->valid_field_names[$field_name])) { |
| 231 | throw new \Exception("getFieldValue: Invalid field name: {$field_name}", 1); |
| 232 | } |
| 233 | return $this->{$field_name}; |
| 234 | } |
| 235 | |
| 236 | public function setFieldValue(string $field_name, mixed $new_field_value): void { |
| 237 | if (!isset($this->valid_field_names[$field_name])) { |
| 238 | throw new \Exception("setFieldValue: Invalid field name: {$field_name}", 1); |
| 239 | } |
| 240 | $this->{$field_name} = $new_field_value; |
| 241 | } |
| 242 | |
| 243 | // --- |
| 244 | |
| 245 | public function testOnlyGetField(string $field_name): mixed { |
| 246 | return $this->{$field_name}; |
| 247 | } |
| 248 | } |