Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
68.12% covered (warning)
68.12%
47 / 69
67.21% covered (warning)
67.21%
41 / 61
CRAP
0.00% covered (danger)
0.00%
0 / 1
Termin
68.12% covered (warning)
68.12%
47 / 69
67.21% covered (warning)
67.21%
41 / 61
196.76
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
 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
 getGo2olId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setGo2olId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCoordinateX
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setCoordinateX
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCoordinateY
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setCoordinateY
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 $go2ol;
87
88    #[ORM\Column(type: 'text', nullable: true)]
89    private ?string $text;
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: 'integer', nullable: true)]
103    private ?int $xkoord;
104
105    #[ORM\Column(type: 'integer', nullable: true)]
106    private ?int $ykoord;
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    /** @return Collection<int|string, TerminLabel>&iterable<TerminLabel> */
211    public function getLabels(): Collection {
212        return $this->labels;
213    }
214
215    public function addLabel(TerminLabel $label): void {
216        $this->labels->add($label);
217    }
218
219    public function removeLabel(TerminLabel $label): void {
220        $this->labels->removeElement($label);
221    }
222
223    public function clearLabels(): void {
224        $this->labels->clear();
225    }
226
227    public function getSolvId(): ?int {
228        return $this->solv_uid;
229    }
230
231    public function setSolvId(?int $new_value): void {
232        $this->solv_uid = $new_value;
233    }
234
235    // @deprecated Use SolvId to get the go2ol (or other platform) ID
236    public function getGo2olId(): ?string {
237        return $this->go2ol;
238    }
239
240    // @deprecated Use SolvId to get the go2ol (or other platform) ID
241    public function setGo2olId(?string $new_value): void {
242        $this->go2ol = $new_value;
243    }
244
245    public function getCoordinateX(): ?int {
246        return $this->xkoord;
247    }
248
249    public function setCoordinateX(?int $new_value): void {
250        $this->xkoord = $new_value;
251    }
252
253    public function getCoordinateY(): ?int {
254        return $this->ykoord;
255    }
256
257    public function setCoordinateY(?int $new_value): void {
258        $this->ykoord = $new_value;
259    }
260
261    public function getLocation(): ?TerminLocation {
262        return $this->location;
263    }
264
265    public function setLocation(?TerminLocation $new_value): void {
266        $this->location = $new_value;
267    }
268
269    public function getNewsletter(): bool {
270        return $this->newsletter;
271    }
272
273    public function setNewsletter(bool $new_value): void {
274        $this->newsletter = $new_value;
275    }
276
277    /** @return array<string> */
278    public function getImageIds(): array {
279        if ($this->image_ids == null) {
280            return [];
281        }
282        $array = json_decode($this->image_ids, true);
283        return is_array($array) ? $array : [];
284    }
285
286    /** @param array<string> $new_value */
287    public function setImageIds(array $new_value): void {
288        $enc_value = json_encode($new_value);
289        if (!$enc_value) {
290            return;
291        }
292        $this->image_ids = $enc_value;
293    }
294
295    public function getOrganizerUser(): ?User {
296        return $this->organizer_user;
297    }
298
299    public function setOrganizerUser(?User $new_value): void {
300        $this->organizer_user = $new_value;
301    }
302
303    public function getParticipantsRegistration(): ?Registration {
304        return $this->participants_registration;
305    }
306
307    public function setParticipantsRegistration(?Registration $new_value): void {
308        $this->participants_registration = $new_value;
309    }
310
311    public function getNumParticipants(): ?int {
312        return $this->num_participants;
313    }
314
315    public function setNumParticipants(?int $new_value): void {
316        $this->num_participants = $new_value;
317    }
318
319    public function getMinParticipants(): ?int {
320        return $this->min_participants;
321    }
322
323    public function setMinParticipants(?int $new_value): void {
324        $this->min_participants = $new_value;
325    }
326
327    public function getMaxParticipants(): ?int {
328        return $this->max_participants;
329    }
330
331    public function setMaxParticipants(?int $new_value): void {
332        $this->max_participants = $new_value;
333    }
334
335    public function getVolunteersRegistration(): ?Registration {
336        return $this->volunteers_registration;
337    }
338
339    public function setVolunteersRegistration(?Registration $new_value): void {
340        $this->volunteers_registration = $new_value;
341    }
342
343    public function getNumVolunteers(): ?int {
344        return $this->num_volunteers;
345    }
346
347    public function setNumVolunteers(?int $new_value): void {
348        $this->num_volunteers = $new_value;
349    }
350
351    public function getMinVolunteers(): ?int {
352        return $this->min_volunteers;
353    }
354
355    public function setMinVolunteers(?int $new_value): void {
356        $this->min_volunteers = $new_value;
357    }
358
359    public function getMaxVolunteers(): ?int {
360        return $this->max_volunteers;
361    }
362
363    public function setMaxVolunteers(?int $new_value): void {
364        $this->max_volunteers = $new_value;
365    }
366
367    // ---
368
369    public function testOnlyGetField(string $field_name): mixed {
370        return $this->{$field_name};
371    }
372
373    public static function getEntityNameForStorage(): string {
374        return 'termine';
375    }
376
377    public function getEntityIdForStorage(): string {
378        return "{$this->getId()}";
379    }
380}