<?phpnamespace App\Entity\GroupTicket;use App\Entity\User;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity]class Teacher extends User{ #[ORM\OneToMany(mappedBy: 'teacher', targetEntity: GroupTicket::class, cascade: ["all"])] private Collection $groupTickets; #[ORM\ManyToOne(inversedBy: 'teachers')] private ?School $school = null; #[ORM\ManyToMany(targetEntity: School::class)] #[ORM\JoinTable(name: 'group_tickets_teacher_additional_schools')] private Collection $additionalSchools; #[ORM\Column(type: Types::DATE_MUTABLE)] #[Assert\NotBlank] private ?\DateTimeInterface $birthday = null; public function __construct() { parent::__construct(); $this->groupTickets = new ArrayCollection(); $this->additionalSchools = new ArrayCollection(); } /** * @return Collection<int, GroupTicket> */ public function getGroupTickets(): Collection { return $this->groupTickets; } public function addGroupTicket(GroupTicket $groupTicket): static { if (!$this->groupTickets->contains($groupTicket)) { $this->groupTickets->add($groupTicket); $groupTicket->setTeacher($this); } return $this; } public function removeGroupTicket(GroupTicket $groupTicket): static { if ($this->groupTickets->removeElement($groupTicket)) { // set the owning side to null (unless already changed) if ($groupTicket->getTeacher() === $this) { $groupTicket->setTeacher(null); } } return $this; } public function getSchool(): ?School { return $this->school; } public function setSchool(?School $school): static { $this->school = $school; return $this; } /** * @return Collection<int, School> */ public function getAdditionalSchools(): Collection { return $this->additionalSchools; } public function addAdditionalSchool(School $school): static { if (!$this->additionalSchools->contains($school)) { $this->additionalSchools->add($school); } return $this; } public function removeAdditionalSchool(School $school): static { $this->additionalSchools->removeElement($school); return $this; } public function getBirthday(): ?\DateTimeInterface { return $this->birthday; } public function setBirthday(?\DateTimeInterface $birthday): static { $this->birthday = $birthday; return $this; } public function getDidokRestriktion(): string { $pc = $this->getSchool()->getTransportCompany()->getPublicConnections(); foreach ($pc as $item){ return $item->getRestriktionLabelKey(); } return ''; }}