Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
80 / 80 |
|
100.00% |
36 / 36 |
CRAP | |
100.00% |
1 / 1 |
| Termin | |
100.00% |
80 / 80 |
|
100.00% |
36 / 36 |
46 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| __toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| addKalender | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
3 | |||
| addKalenderTermin | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
2 | |||
| getAlarmvorlaufzeit | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setAlarmvorlaufzeit | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getAnzeigenAls | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setAnzeigenAls | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getEndzeit | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getErledigtam | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setErledigtam | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| getFarbwert | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setFarbwert | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getFortschritt | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setFortschritt | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getKalender | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| getKalenderTermine | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSynchid | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setSynchid | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getTermintyp | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setTermintyp | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getVaterlfdnr | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setVaterlfdnr | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getAlarmzeit | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setAlarmzeit | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| getWiederholung | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setWiederholung | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getWiederholunginfo | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setWiederholunginfo | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| isAktiv | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isGanztags | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| removeKalender | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
3 | |||
| removeKalenderTermin | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
2 | |||
| setAktiv | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| setEndzeit | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| setGanztags | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Satag\AmicronEntityBundle\Entity; |
| 6 | |
| 7 | use Doctrine\Common\Collections\ArrayCollection; |
| 8 | use Doctrine\Common\Collections\Collection; |
| 9 | use Doctrine\DBAL\Types\Types; |
| 10 | use Doctrine\ORM\Mapping as ORM; |
| 11 | use Symfony\Component\Validator\Constraints as Assert; |
| 12 | |
| 13 | #[ORM\Entity] |
| 14 | #[ORM\HasLifecycleCallbacks] |
| 15 | class Termin extends AbstractAufgabeTermin implements \Stringable |
| 16 | { |
| 17 | final public const int ABWESEND = 3; |
| 18 | final public const int FARBWERT_KEINE = 16_777_215; |
| 19 | final public const int FREI = 0; |
| 20 | final public const int GEBUCHT = 2; |
| 21 | final public const int STATUS_ERLEDIGT = 2; |
| 22 | final public const int STATUS_OFFEN = 0; |
| 23 | final public const int VORBEHALT = 1; |
| 24 | |
| 25 | #[ORM\Column(name: 'aktiv', type: Types::BOOLEAN, length: 1, nullable: true)] |
| 26 | private ?bool $aktiv = true; |
| 27 | |
| 28 | #[ORM\Column(name: 'alarmvorlaufzeit', type: Types::INTEGER, nullable: true)] |
| 29 | private ?int $alarmvorlaufzeit = null; |
| 30 | |
| 31 | #[ORM\Column(name: 'terminstatus', type: Types::INTEGER, nullable: true)] |
| 32 | #[Assert\Choice([0, 1, 2, 3], message: '::FREI, ::VORBEHALT, ')] |
| 33 | private ?int $anzeigenals = self::GEBUCHT; |
| 34 | |
| 35 | #[ORM\Column(name: 'erledigtam', type: Types::DATETIME_IMMUTABLE, nullable: true)] |
| 36 | private ?\DateTimeImmutable $erledigtam = null; |
| 37 | |
| 38 | #[ORM\Column(name: 'farbwert', type: Types::INTEGER, nullable: true)] |
| 39 | private ?int $farbwert = self::FARBWERT_KEINE; |
| 40 | |
| 41 | #[ORM\Column(name: 'fortschritt', type: Types::INTEGER, nullable: true)] |
| 42 | private ?int $fortschritt = 0; |
| 43 | |
| 44 | #[ORM\Column(name: 'ganztags', type: Types::BOOLEAN, length: 1, nullable: true)] |
| 45 | private ?bool $ganztags = null; |
| 46 | |
| 47 | /** |
| 48 | * @var Collection<int, KalenderTermin> |
| 49 | */ |
| 50 | #[ORM\OneToMany(mappedBy: 'termin', targetEntity: KalenderTermin::class, cascade: ['persist'], fetch: 'EXTRA_LAZY', orphanRemoval: true)] |
| 51 | private Collection $kalenderTermine; |
| 52 | |
| 53 | #[ORM\Column(name: 'synchid', type: Types::STRING, length: 255, nullable: true)] |
| 54 | private ?string $synchid = null; |
| 55 | |
| 56 | #[ORM\Column(name: 'termintyp', type: Types::INTEGER, nullable: true)] |
| 57 | private ?int $termintyp = 0; |
| 58 | |
| 59 | #[ORM\Column(name: 'vaterlfdnr', type: Types::INTEGER, nullable: true)] |
| 60 | private ?int $vaterlfdnr = null; |
| 61 | |
| 62 | #[ORM\Column(name: 'alarmzeit', type: Types::DATETIME_IMMUTABLE, nullable: true)] |
| 63 | private ?\DateTimeImmutable $alarmzeit = null; |
| 64 | |
| 65 | #[ORM\Column(name: 'wiederholung', type: Types::INTEGER, nullable: true)] |
| 66 | private ?int $wiederholung = -1; |
| 67 | |
| 68 | #[ORM\Column(name: 'wiederholunginfo', type: 'blob_base64', nullable: true)] |
| 69 | private ?string $wiederholunginfo = null; |
| 70 | |
| 71 | public function __construct( |
| 72 | ) { |
| 73 | parent::__construct(); |
| 74 | $this->kalenderTermine = new ArrayCollection(); |
| 75 | } |
| 76 | |
| 77 | #[\Override] |
| 78 | public function __toString(): string |
| 79 | { |
| 80 | return \sprintf('\\Termin:%s (%s)', $this->lfdnr, $this->betreff); |
| 81 | } |
| 82 | |
| 83 | public function addKalender(Kalender $kalender): self |
| 84 | { |
| 85 | foreach ($this->getKalenderTermine() as $kalenderTermin) { |
| 86 | if ($kalenderTermin->getKalender() === $kalender) { |
| 87 | return $this; |
| 88 | } |
| 89 | } |
| 90 | $kalenderTermin = new KalenderTermin(); |
| 91 | $kalenderTermin |
| 92 | ->setTermin($this) |
| 93 | ->setKalender($kalender); |
| 94 | $this->addKalenderTermin($kalenderTermin); |
| 95 | |
| 96 | return $this; |
| 97 | } |
| 98 | |
| 99 | public function addKalenderTermin(KalenderTermin $kalenderTermin): void |
| 100 | { |
| 101 | if ($this->kalenderTermine->contains($kalenderTermin)) { |
| 102 | return; |
| 103 | } |
| 104 | |
| 105 | $this->kalenderTermine->add($kalenderTermin); |
| 106 | // needed to update the owning side of the relationship! |
| 107 | $kalenderTermin->setTermin($this); |
| 108 | $kalenderTermin->getKalender()?->addKalenderTermin($kalenderTermin); |
| 109 | } |
| 110 | |
| 111 | public function getAlarmvorlaufzeit(): ?int |
| 112 | { |
| 113 | return $this->alarmvorlaufzeit; |
| 114 | } |
| 115 | |
| 116 | public function setAlarmvorlaufzeit(?int $alarmvorlaufzeit): self |
| 117 | { |
| 118 | $this->alarmvorlaufzeit = $alarmvorlaufzeit; |
| 119 | |
| 120 | return $this; |
| 121 | } |
| 122 | |
| 123 | public function getAnzeigenAls(): ?int |
| 124 | { |
| 125 | return $this->anzeigenals; |
| 126 | } |
| 127 | |
| 128 | public function setAnzeigenAls(?int $anzeigenals = null): self |
| 129 | { |
| 130 | $this->anzeigenals = $anzeigenals; |
| 131 | |
| 132 | return $this; |
| 133 | } |
| 134 | |
| 135 | public function getEndzeit(): ?\DateTimeImmutable |
| 136 | { |
| 137 | return $this->endzeit; |
| 138 | } |
| 139 | |
| 140 | public function getErledigtam(): ?\DateTimeImmutable |
| 141 | { |
| 142 | return $this->erledigtam; |
| 143 | } |
| 144 | |
| 145 | public function setErledigtam(\DateTimeImmutable|\DateTime|null $erledigtam = null): self |
| 146 | { |
| 147 | $this->erledigtam = $erledigtam instanceof \DateTime |
| 148 | ? \DateTimeImmutable::createFromMutable($erledigtam) |
| 149 | : $erledigtam; |
| 150 | |
| 151 | return $this; |
| 152 | } |
| 153 | |
| 154 | public function getFarbwert(): ?int |
| 155 | { |
| 156 | return $this->farbwert; |
| 157 | } |
| 158 | |
| 159 | public function setFarbwert(?int $farbwert): self |
| 160 | { |
| 161 | $this->farbwert = $farbwert; |
| 162 | |
| 163 | return $this; |
| 164 | } |
| 165 | |
| 166 | public function getFortschritt(): ?int |
| 167 | { |
| 168 | return $this->fortschritt; |
| 169 | } |
| 170 | |
| 171 | public function setFortschritt(?int $fortschritt = null): self |
| 172 | { |
| 173 | $this->fortschritt = $fortschritt; |
| 174 | |
| 175 | return $this; |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * @return ArrayCollection<int, Kalender> |
| 180 | */ |
| 181 | public function getKalender(): ArrayCollection |
| 182 | { |
| 183 | $kalender = new ArrayCollection(); |
| 184 | foreach ($this->getKalenderTermine() as $kalenderTermin) { |
| 185 | $kalender->add($kalenderTermin->getKalender()); |
| 186 | } |
| 187 | |
| 188 | return $kalender; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * @return Collection<int, KalenderTermin> |
| 193 | */ |
| 194 | public function getKalenderTermine(): Collection |
| 195 | { |
| 196 | return $this->kalenderTermine; |
| 197 | } |
| 198 | |
| 199 | public function getSynchid(): ?string |
| 200 | { |
| 201 | return $this->synchid; |
| 202 | } |
| 203 | |
| 204 | public function setSynchid(?string $synchid = null): self |
| 205 | { |
| 206 | $this->synchid = $synchid; |
| 207 | |
| 208 | return $this; |
| 209 | } |
| 210 | |
| 211 | public function getTermintyp(): ?int |
| 212 | { |
| 213 | return $this->termintyp; |
| 214 | } |
| 215 | |
| 216 | public function setTermintyp(?int $termintyp): self |
| 217 | { |
| 218 | $this->termintyp = $termintyp; |
| 219 | |
| 220 | return $this; |
| 221 | } |
| 222 | |
| 223 | public function getVaterlfdnr(): ?int |
| 224 | { |
| 225 | return $this->vaterlfdnr; |
| 226 | } |
| 227 | |
| 228 | public function setVaterlfdnr(?int $vaterlfdnr): self |
| 229 | { |
| 230 | $this->vaterlfdnr = $vaterlfdnr; |
| 231 | |
| 232 | return $this; |
| 233 | } |
| 234 | |
| 235 | public function getAlarmzeit(): ?\DateTimeImmutable |
| 236 | { |
| 237 | return $this->alarmzeit; |
| 238 | } |
| 239 | |
| 240 | public function setAlarmzeit(\DateTimeImmutable|\DateTime|null $alarmzeit): self |
| 241 | { |
| 242 | $this->alarmzeit = $alarmzeit instanceof \DateTime |
| 243 | ? \DateTimeImmutable::createFromMutable($alarmzeit) |
| 244 | : $alarmzeit; |
| 245 | |
| 246 | return $this; |
| 247 | } |
| 248 | |
| 249 | public function getWiederholung(): ?int |
| 250 | { |
| 251 | return $this->wiederholung; |
| 252 | } |
| 253 | |
| 254 | public function setWiederholung(?int $wiederholung = null): self |
| 255 | { |
| 256 | $this->wiederholung = $wiederholung; |
| 257 | |
| 258 | return $this; |
| 259 | } |
| 260 | |
| 261 | public function getWiederholunginfo(): ?string |
| 262 | { |
| 263 | return $this->wiederholunginfo; |
| 264 | } |
| 265 | |
| 266 | public function setWiederholunginfo(?string $wiederholunginfo): self |
| 267 | { |
| 268 | $this->wiederholunginfo = $wiederholunginfo; |
| 269 | |
| 270 | return $this; |
| 271 | } |
| 272 | |
| 273 | public function isAktiv(): bool |
| 274 | { |
| 275 | return (bool) $this->aktiv; |
| 276 | } |
| 277 | |
| 278 | public function isGanztags(): ?bool |
| 279 | { |
| 280 | return $this->ganztags; |
| 281 | } |
| 282 | |
| 283 | public function removeKalender(Kalender $kalender): self |
| 284 | { |
| 285 | foreach ($this->getKalenderTermine() as $kalenderTermin) { |
| 286 | if ($kalenderTermin->getKalender() === $kalender) { |
| 287 | $this->removeKalenderTermin($kalenderTermin); |
| 288 | |
| 289 | return $this; |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | return $this; |
| 294 | } |
| 295 | |
| 296 | public function removeKalenderTermin(KalenderTermin $kalenderTermin): void |
| 297 | { |
| 298 | if (!$this->kalenderTermine->contains($kalenderTermin)) { |
| 299 | return; |
| 300 | } |
| 301 | $this->kalenderTermine->removeElement($kalenderTermin); |
| 302 | // needed to update the owning side of the relationship! |
| 303 | $kalenderTermin->getKalender()?->removeKalenderTermin($kalenderTermin); |
| 304 | $kalenderTermin->setTermin(null); |
| 305 | } |
| 306 | |
| 307 | public function setAktiv(?bool $aktiv = null): self |
| 308 | { |
| 309 | $this->aktiv = $aktiv; |
| 310 | |
| 311 | return $this; |
| 312 | } |
| 313 | |
| 314 | public function setEndzeit(\DateTimeImmutable|\DateTime|null $endzeit = null): self |
| 315 | { |
| 316 | $this->endzeit = $endzeit instanceof \DateTime |
| 317 | ? \DateTimeImmutable::createFromMutable($endzeit) |
| 318 | : $endzeit; |
| 319 | |
| 320 | return $this; |
| 321 | } |
| 322 | |
| 323 | public function setGanztags(?bool $ganztags = null): self |
| 324 | { |
| 325 | $this->ganztags = $ganztags; |
| 326 | |
| 327 | return $this; |
| 328 | } |
| 329 | } |