Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
65.22% covered (warning)
65.22%
45 / 69
63.93% covered (warning)
63.93%
39 / 61
CRAP
0.00% covered (danger)
0.00%
0 / 1
Termin
65.22% covered (warning)
65.22%
45 / 69
63.93% covered (warning)
63.93%
39 / 61
236.36
0.00% covered (danger)
0.00%
0 / 1
 id
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFromTemplate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setFromTemplate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getStartDate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setStartDate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getStartTime
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setStartTime
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEndDate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setEndDate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEndTime
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setEndTime
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDeadline
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setDeadline
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getShouldPromote
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setShouldPromote
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getTitle
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setTitle
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getText
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setText
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDocumentation
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setDocumentation
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getLabels
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 addLabel
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 removeLabel
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 clearLabels
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSolvId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSolvId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getLatitude
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setLatitude
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getLongitude
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setLongitude
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getLocation
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setLocation
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getNewsletter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setNewsletter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getImageIds
75.00% covered (warning)
75.00%
3 / 4
0.00% covered (danger)
0.00%
0 / 1
3.14
 setImageIds
75.00% covered (warning)
75.00%
3 / 4
0.00% covered (danger)
0.00%
0 / 1
2.06
 getOrganizerUser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setOrganizerUser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getParticipantsRegistration
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setParticipantsRegistration
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getNumParticipants
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setNumParticipants
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getMinParticipants
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setMinParticipants
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getMaxParticipants
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setMaxParticipants
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getVolunteersRegistration
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setVolunteersRegistration
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getNumVolunteers
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setNumVolunteers
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getMinVolunteers
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setMinVolunteers
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getMaxVolunteers
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setMaxVolunteers
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 testOnlyGetField
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEntityNameForStorage
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEntityIdForStorage
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Olz\Entity\Termine;
4
5use Doctrine\Common\Collections\ArrayCollection;
6use Doctrine\Common\Collections\Collection;
7use Doctrine\ORM\Mapping as ORM;
8use Olz\Entity\Anmelden\Registration;
9use Olz\Entity\Common\DataStorageInterface;
10use Olz\Entity\Common\DataStorageTrait;
11use Olz\Entity\Common\OlzEntity;
12use Olz\Entity\Common\TestableInterface;
13use Olz\Entity\Users\User;
14use Olz\Repository\Termine\TerminRepository;
15
16#[ORM\Table(name: 'termine')]
17#[ORM\Index(name: 'start_date_on_off_index', columns: ['start_date', 'on_off'])]
18#[ORM\Entity(repositoryClass: TerminRepository::class)]
19class Termin extends OlzEntity implements DataStorageInterface, TestableInterface {
20    use DataStorageTrait;
21
22    #[ORM\Id]
23    #[ORM\Column(type: 'integer', nullable: false)]
24    #[ORM\GeneratedValue]
25    private int $id;
26
27    #[ORM\ManyToOne(targetEntity: TerminTemplate::class)]
28    #[ORM\JoinColumn(name: 'from_template_id', referencedColumnName: 'id')]
29    private ?TerminTemplate $from_template;
30
31    #[ORM\Column(type: 'date', nullable: false)]
32    private \DateTime $start_date;
33
34    #[ORM\Column(type: 'time', nullable: true)]
35    private ?\DateTime $start_time;
36
37    #[ORM\Column(type: 'date', nullable: true)]
38    private ?\DateTime $end_date;
39
40    #[ORM\Column(type: 'time', nullable: true)]
41    private ?\DateTime $end_time;
42
43    #[ORM\Column(type: 'datetime', nullable: true)]
44    private ?\DateTime $deadline;
45
46    #[ORM\Column(type: 'boolean', nullable: false, options: ['default' => 0])]
47    private bool $should_promote;
48
49    #[ORM\ManyToOne(targetEntity: User::class)]
50    #[ORM\JoinColumn(name: 'organizer_user_id', referencedColumnName: 'id', nullable: true)]
51    protected ?User $organizer_user;
52
53    #[ORM\ManyToOne(targetEntity: Registration::class)]
54    #[ORM\JoinColumn(name: 'participants_registration_id', referencedColumnName: 'id')]
55    private ?Registration $participants_registration;
56
57    #[ORM\Column(type: 'integer', nullable: true)]
58    private ?int $num_participants;
59
60    #[ORM\Column(type: 'integer', nullable: true)]
61    private ?int $min_participants;
62
63    #[ORM\Column(type: 'integer', nullable: true)]
64    private ?int $max_participants;
65
66    #[ORM\ManyToOne(targetEntity: Registration::class)]
67    #[ORM\JoinColumn(name: 'volunteers_registration_id', referencedColumnName: 'id')]
68    private ?Registration $volunteers_registration;
69
70    #[ORM\Column(type: 'integer', nullable: true)]
71    private ?int $num_volunteers;
72
73    #[ORM\Column(type: 'integer', nullable: true)]
74    private ?int $min_volunteers;
75
76    #[ORM\Column(type: 'integer', nullable: true)]
77    private ?int $max_volunteers;
78
79    #[ORM\Column(type: 'boolean', nullable: false, options: ['default' => 0])]
80    private bool $newsletter;
81
82    #[ORM\Column(type: 'text', nullable: true)]
83    private ?string $title;
84
85    #[ORM\Column(type: 'text', nullable: true)]
86    private ?string $text;
87
88    #[ORM\Column(type: 'text', nullable: true)]
89    private ?string $documentation;
90
91    /** @var Collection<int|string, TerminLabel>&iterable<TerminLabel> */
92    #[ORM\JoinTable(name: 'termin_label_map')]
93    #[ORM\JoinColumn(name: 'termin_id', referencedColumnName: 'id')]
94    #[ORM\InverseJoinColumn(name: 'label_id', referencedColumnName: 'id')]
95    #[ORM\ManyToMany(targetEntity: TerminLabel::class, inversedBy: 'termine')]
96    private Collection $labels;
97
98    #[ORM\ManyToOne(targetEntity: TerminLocation::class)]
99    #[ORM\JoinColumn(name: 'location_id', referencedColumnName: 'id', nullable: true)]
100    private ?TerminLocation $location;
101
102    #[ORM\Column(type: 'float', nullable: true)]
103    private ?float $latitude;
104
105    #[ORM\Column(type: 'float', nullable: true)]
106    private ?float $longitude;
107
108    #[ORM\Column(type: 'integer', nullable: true)]
109    private ?int $solv_uid;
110
111    #[ORM\Column(type: 'text', nullable: true)]
112    private ?string $image_ids;
113
114    // PRIMARY KEY (`id`),
115    // KEY `datum` (`datum`),
116    // KEY `on_off` (`on_off`),
117    // KEY `datum_end` (`datum_end`),
118    // KEY `datum_off` (`datum_off`)
119
120    public static function id(int $id): self {
121        $entity = new self();
122        $entity->setId($id);
123        return $entity;
124    }
125
126    public function __construct() {
127        $this->labels = new ArrayCollection();
128    }
129
130    public function getId(): ?int {
131        return $this->id ?? null;
132    }
133
134    public function setId(int $new_value): void {
135        $this->id = $new_value;
136    }
137
138    public function getFromTemplate(): ?TerminTemplate {
139        return $this->from_template;
140    }
141
142    public function setFromTemplate(?TerminTemplate $new_value): void {
143        $this->from_template = $new_value;
144    }
145
146    public function getStartDate(): \DateTime {
147        return $this->start_date;
148    }
149
150    public function setStartDate(\DateTime $new_value): void {
151        $this->start_date = $new_value;
152    }
153
154    public function getStartTime(): ?\DateTime {
155        return $this->start_time;
156    }
157
158    public function setStartTime(?\DateTime $new_value): void {
159        $this->start_time = $new_value;
160    }
161
162    public function getEndDate(): ?\DateTime {
163        return $this->end_date;
164    }
165
166    public function setEndDate(?\DateTime $new_value): void {
167        $this->end_date = $new_value;
168    }
169
170    public function getEndTime(): ?\DateTime {
171        return $this->end_time;
172    }
173
174    public function setEndTime(?\DateTime $new_value): void {
175        $this->end_time = $new_value;
176    }
177
178    public function getDeadline(): ?\DateTime {
179        return $this->deadline;
180    }
181
182    public function setDeadline(?\DateTime $new_value): void {
183        $this->deadline = $new_value;
184    }
185
186    public function getShouldPromote(): bool {
187        return $this->should_promote;
188    }
189
190    public function setShouldPromote(bool $new_value): void {
191        $this->should_promote = $new_value;
192    }
193
194    public function getTitle(): ?string {
195        return $this->title;
196    }
197
198    public function setTitle(?string $new_value): void {
199        $this->title = $new_value;
200    }
201
202    public function getText(): ?string {
203        return $this->text;
204    }
205
206    public function setText(?string $new_value): void {
207        $this->text = $new_value;
208    }
209
210    public function getDocumentation(): ?string {
211        return $this->documentation;
212    }
213
214    public function setDocumentation(?string $new_value): void {
215        $this->documentation = $new_value;
216    }
217
218    /** @return Collection<int|string, TerminLabel>&iterable<TerminLabel> */
219    public function getLabels(): Collection {
220        return $this->labels;
221    }
222
223    public function addLabel(TerminLabel $label): void {
224        $this->labels->add($label);
225    }
226
227    public function removeLabel(TerminLabel $label): void {
228        $this->labels->removeElement($label);
229    }
230
231    public function clearLabels(): void {
232        $this->labels->clear();
233    }
234
235    public function getSolvId(): ?int {
236        return $this->solv_uid;
237    }
238
239    public function setSolvId(?int $new_value): void {
240        $this->solv_uid = $new_value;
241    }
242
243    public function getLatitude(): ?float {
244        return $this->latitude;
245    }
246
247    public function setLatitude(?float $new_value): void {
248        $this->latitude = $new_value;
249    }
250
251    public function getLongitude(): ?float {
252        return $this->longitude;
253    }
254
255    public function setLongitude(?float $new_value): void {
256        $this->longitude = $new_value;
257    }
258
259    public function getLocation(): ?TerminLocation {
260        return $this->location;
261    }
262
263    public function setLocation(?TerminLocation $new_value): void {
264        $this->location = $new_value;
265    }
266
267    public function getNewsletter(): bool {
268        return $this->newsletter;
269    }
270
271    public function setNewsletter(bool $new_value): void {
272        $this->newsletter = $new_value;
273    }
274
275    /** @return array<string> */
276    public function getImageIds(): array {
277        if ($this->image_ids == null) {
278            return [];
279        }
280        $array = json_decode($this->image_ids, true);
281        return is_array($array) ? $array : [];
282    }
283
284    /** @param array<string> $new_value */
285    public function setImageIds(array $new_value): void {
286        $enc_value = json_encode($new_value);
287        if (!$enc_value) {
288            return;
289        }
290        $this->image_ids = $enc_value;
291    }
292
293    public function getOrganizerUser(): ?User {
294        return $this->organizer_user;
295    }
296
297    public function setOrganizerUser(?User $new_value): void {
298        $this->organizer_user = $new_value;
299    }
300
301    public function getParticipantsRegistration(): ?Registration {
302        return $this->participants_registration;
303    }
304
305    public function setParticipantsRegistration(?Registration $new_value): void {
306        $this->participants_registration = $new_value;
307    }
308
309    public function getNumParticipants(): ?int {
310        return $this->num_participants;
311    }
312
313    public function setNumParticipants(?int $new_value): void {
314        $this->num_participants = $new_value;
315    }
316
317    public function getMinParticipants(): ?int {
318        return $this->min_participants;
319    }
320
321    public function setMinParticipants(?int $new_value): void {
322        $this->min_participants = $new_value;
323    }
324
325    public function getMaxParticipants(): ?int {
326        return $this->max_participants;
327    }
328
329    public function setMaxParticipants(?int $new_value): void {
330        $this->max_participants = $new_value;
331    }
332
333    public function getVolunteersRegistration(): ?Registration {
334        return $this->volunteers_registration;
335    }
336
337    public function setVolunteersRegistration(?Registration $new_value): void {
338        $this->volunteers_registration = $new_value;
339    }
340
341    public function getNumVolunteers(): ?int {
342        return $this->num_volunteers;
343    }
344
345    public function setNumVolunteers(?int $new_value): void {
346        $this->num_volunteers = $new_value;
347    }
348
349    public function getMinVolunteers(): ?int {
350        return $this->min_volunteers;
351    }
352
353    public function setMinVolunteers(?int $new_value): void {
354        $this->min_volunteers = $new_value;
355    }
356
357    public function getMaxVolunteers(): ?int {
358        return $this->max_volunteers;
359    }
360
361    public function setMaxVolunteers(?int $new_value): void {
362        $this->max_volunteers = $new_value;
363    }
364
365    // ---
366
367    public function testOnlyGetField(string $field_name): mixed {
368        return $this->{$field_name};
369    }
370
371    public static function getEntityNameForStorage(): string {
372        return 'termine';
373    }
374
375    public function getEntityIdForStorage(): string {
376        return "{$this->getId()}";
377    }
378}