Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 26 |
|
0.00% |
0 / 18 |
CRAP | |
0.00% |
0 / 1 |
TerminLocation | |
0.00% |
0 / 26 |
|
0.00% |
0 / 18 |
462 | |
0.00% |
0 / 1 |
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setId | |
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 | |||
getDetails | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setDetails | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getLatitude | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setLatitude | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getLongitude | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setLongitude | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getImageIds | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
setImageIds | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
getIdFieldNameForSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getIdForSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCriteriaForQuery | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getTitleForSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getEntityNameForStorage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getEntityIdForStorage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\Entity\Termine; |
4 | |
5 | use Doctrine\Common\Collections\Criteria; |
6 | use Doctrine\Common\Collections\Expr\Expression; |
7 | use Doctrine\ORM\Mapping as ORM; |
8 | use Olz\Entity\Common\DataStorageInterface; |
9 | use Olz\Entity\Common\DataStorageTrait; |
10 | use Olz\Entity\Common\OlzEntity; |
11 | use Olz\Entity\Common\SearchableInterface; |
12 | use Olz\Repository\Termine\TerminLocationRepository; |
13 | |
14 | #[ORM\Table(name: 'termin_locations')] |
15 | #[ORM\Index(name: 'name_index', columns: ['name'])] |
16 | #[ORM\Entity(repositoryClass: TerminLocationRepository::class)] |
17 | class TerminLocation extends OlzEntity implements SearchableInterface, DataStorageInterface { |
18 | use DataStorageTrait; |
19 | |
20 | #[ORM\Id] |
21 | #[ORM\Column(type: 'integer', nullable: false)] |
22 | #[ORM\GeneratedValue] |
23 | private int $id; |
24 | |
25 | #[ORM\Column(type: 'string', length: 127, nullable: false)] |
26 | private string $name; |
27 | |
28 | #[ORM\Column(type: 'text', nullable: true)] |
29 | private ?string $details; |
30 | |
31 | #[ORM\Column(type: 'float', nullable: false)] |
32 | private float $latitude; |
33 | |
34 | #[ORM\Column(type: 'float', nullable: false)] |
35 | private float $longitude; |
36 | |
37 | #[ORM\Column(type: 'text', nullable: true)] |
38 | private ?string $image_ids; |
39 | |
40 | public function getId(): ?int { |
41 | return $this->id ?? null; |
42 | } |
43 | |
44 | public function setId(int $new_value): void { |
45 | $this->id = $new_value; |
46 | } |
47 | |
48 | public function getName(): string { |
49 | return $this->name; |
50 | } |
51 | |
52 | public function setName(string $new_value): void { |
53 | $this->name = $new_value; |
54 | } |
55 | |
56 | public function getDetails(): ?string { |
57 | return $this->details; |
58 | } |
59 | |
60 | public function setDetails(?string $new_value): void { |
61 | $this->details = $new_value; |
62 | } |
63 | |
64 | public function getLatitude(): float { |
65 | return $this->latitude; |
66 | } |
67 | |
68 | public function setLatitude(float $new_value): void { |
69 | $this->latitude = $new_value; |
70 | } |
71 | |
72 | public function getLongitude(): float { |
73 | return $this->longitude; |
74 | } |
75 | |
76 | public function setLongitude(float $new_value): void { |
77 | $this->longitude = $new_value; |
78 | } |
79 | |
80 | /** @return array<string> */ |
81 | public function getImageIds(): array { |
82 | if ($this->image_ids == null) { |
83 | return []; |
84 | } |
85 | $array = json_decode($this->image_ids, true); |
86 | return is_array($array) ? $array : []; |
87 | } |
88 | |
89 | /** @param array<string> $new_value */ |
90 | public function setImageIds(array $new_value): void { |
91 | $enc_value = json_encode($new_value); |
92 | if (!$enc_value) { |
93 | return; |
94 | } |
95 | $this->image_ids = $enc_value; |
96 | } |
97 | |
98 | // --- |
99 | |
100 | public static function getIdFieldNameForSearch(): string { |
101 | return 'id'; |
102 | } |
103 | |
104 | public function getIdForSearch(): int { |
105 | return $this->getId() ?? 0; |
106 | } |
107 | |
108 | public static function getCriteriaForQuery(string $query): Expression { |
109 | return Criteria::expr()->orX( |
110 | Criteria::expr()->contains('name', $query), |
111 | ); |
112 | } |
113 | |
114 | public function getTitleForSearch(): string { |
115 | return $this->getName(); |
116 | } |
117 | |
118 | public static function getEntityNameForStorage(): string { |
119 | return 'termin_locations'; |
120 | } |
121 | |
122 | public function getEntityIdForStorage(): string { |
123 | return "{$this->getId()}"; |
124 | } |
125 | } |