Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 17 |
|
0.00% |
0 / 16 |
CRAP | |
0.00% |
0 / 1 |
| RunRecord | |
0.00% |
0 / 17 |
|
0.00% |
0 / 16 |
306 | |
0.00% |
0 / 1 |
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
| setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getRunAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setRunAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getDistanceMeters | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setDistanceMeters | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getElevationMeters | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setElevationMeters | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getSource | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setSource | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getInfo | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setInfo | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| __toString | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| testOnlyGetField | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Entity\Anniversary; |
| 4 | |
| 5 | use Doctrine\ORM\Mapping as ORM; |
| 6 | use Olz\Entity\Common\OlzEntity; |
| 7 | use Olz\Entity\Common\TestableInterface; |
| 8 | use Olz\Entity\Users\User; |
| 9 | use Olz\Repository\Anniversary\RunRecordRepository; |
| 10 | |
| 11 | #[ORM\Table(name: 'anniversary_runs')] |
| 12 | #[ORM\Index(name: 'run_at_index', columns: ['run_at'])] |
| 13 | #[ORM\Index(name: 'source_index', columns: ['source'])] |
| 14 | #[ORM\Entity(repositoryClass: RunRecordRepository::class)] |
| 15 | class RunRecord extends OlzEntity implements TestableInterface { |
| 16 | #[ORM\Id] |
| 17 | #[ORM\Column(type: 'bigint', nullable: false)] |
| 18 | #[ORM\GeneratedValue] |
| 19 | private int|string $id; |
| 20 | |
| 21 | #[ORM\ManyToOne(targetEntity: User::class)] |
| 22 | #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: true)] |
| 23 | private ?User $user; |
| 24 | |
| 25 | #[ORM\Column(type: 'datetime', nullable: false)] |
| 26 | private \DateTime $run_at; |
| 27 | |
| 28 | #[ORM\Column(type: 'integer', nullable: false)] |
| 29 | private int $distance_meters; |
| 30 | |
| 31 | #[ORM\Column(type: 'integer', nullable: false)] |
| 32 | private int $elevation_meters; |
| 33 | |
| 34 | #[ORM\Column(type: 'string', nullable: true)] |
| 35 | private ?string $source; |
| 36 | |
| 37 | #[ORM\Column(type: 'text', nullable: true)] |
| 38 | private ?string $info; |
| 39 | |
| 40 | public function getId(): ?int { |
| 41 | return isset($this->id) ? intval($this->id) : null; |
| 42 | } |
| 43 | |
| 44 | public function setId(int $new_id): void { |
| 45 | $this->id = $new_id; |
| 46 | } |
| 47 | |
| 48 | public function getUser(): ?User { |
| 49 | return $this->user; |
| 50 | } |
| 51 | |
| 52 | public function setUser(?User $new_user): void { |
| 53 | $this->user = $new_user; |
| 54 | } |
| 55 | |
| 56 | public function getRunAt(): \DateTime { |
| 57 | return $this->run_at; |
| 58 | } |
| 59 | |
| 60 | public function setRunAt(\DateTime $new_value): void { |
| 61 | $this->run_at = $new_value; |
| 62 | } |
| 63 | |
| 64 | public function getDistanceMeters(): int { |
| 65 | return $this->distance_meters; |
| 66 | } |
| 67 | |
| 68 | public function setDistanceMeters(int $new_value): void { |
| 69 | $this->distance_meters = $new_value; |
| 70 | } |
| 71 | |
| 72 | public function getElevationMeters(): int { |
| 73 | return $this->elevation_meters; |
| 74 | } |
| 75 | |
| 76 | public function setElevationMeters(int $new_value): void { |
| 77 | $this->elevation_meters = $new_value; |
| 78 | } |
| 79 | |
| 80 | public function getSource(): ?string { |
| 81 | return $this->source; |
| 82 | } |
| 83 | |
| 84 | public function setSource(?string $new_value): void { |
| 85 | $this->source = $new_value; |
| 86 | } |
| 87 | |
| 88 | public function getInfo(): ?string { |
| 89 | return $this->info; |
| 90 | } |
| 91 | |
| 92 | public function setInfo(?string $new_value): void { |
| 93 | $this->info = $new_value; |
| 94 | } |
| 95 | |
| 96 | // --- |
| 97 | |
| 98 | public function __toString(): string { |
| 99 | $id = $this->getId(); |
| 100 | return "RunRecord (ID: {$id})"; |
| 101 | } |
| 102 | |
| 103 | public function testOnlyGetField(string $field_name): mixed { |
| 104 | return $this->{$field_name}; |
| 105 | } |
| 106 | } |