<?phpnamespace App\Entity\GroupTicket;use App\Entity\User;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity]class School extends User{ #[ORM\Column(length: 255)] #[Assert\NotBlank] private string $name = ''; #[ORM\OneToMany(mappedBy: 'school', targetEntity: Teacher::class, cascade: ["all"])] private Collection $teachers; #[ORM\ManyToOne(inversedBy: 'schools')] private ?TransportCompany $transportCompany = null; #[ORM\Column] #[Assert\GreaterThanOrEqual( value: 0, message: "validator.min_count" )] private ?int $maxZones = null; #[ORM\OneToMany(mappedBy: 'school', targetEntity: GroupTicketFavorite::class, cascade: ["all"])] private Collection $favorites; #[ORM\OneToOne(inversedBy: 'school', cascade: ["all"])] private ?ContactInformation $contactInformation = null; public function __construct() { parent::__construct(); $this->teachers = new ArrayCollection(); $this->favorites = new ArrayCollection(); } public function getName(): string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } /** * @return Collection<int, Teacher> */ public function getTeachers(): Collection { return $this->teachers; } public function addTeacher(Teacher $teacher): static { if (!$this->teachers->contains($teacher)) { $this->teachers->add($teacher); $teacher->setSchool($this); } return $this; } public function removeTeacher(Teacher $teacher): static { if ($this->teachers->removeElement($teacher)) { // set the owning side to null (unless already changed) if ($teacher->getSchool() === $this) { $teacher->setSchool(null); } } return $this; } public function getTransportCompany(): ?TransportCompany { return $this->transportCompany; } public function setTransportCompany(?TransportCompany $transportCompany): static { $this->transportCompany = $transportCompany; return $this; } public function getMaxZones(): ?int { return $this->maxZones; } public function setMaxZones(int $maxZones): static { $this->maxZones = $maxZones; return $this; } /** * @return Collection<int, GroupTicketFavorite> */ public function getFavorites(): Collection { return $this->favorites; } public function addFavorite(GroupTicketFavorite $favorite): static { if (!$this->favorites->contains($favorite)) { $this->favorites->add($favorite); $favorite->setSchool($this); } return $this; } public function removeFavorite(GroupTicketFavorite $favorite): static { if ($this->favorites->removeElement($favorite)) { // set the owning side to null (unless already changed) if ($favorite->getSchool() === $this) { $favorite->setSchool(null); } } return $this; } public function getDidokRestriktion(): string { $pc = $this->getTransportCompany()->getPublicConnections(); foreach ($pc as $item){ return $item->getRestriktionLabelKey(); } return ''; } public function getContactInformation(): ?ContactInformation { return $this->contactInformation; } public function setContactInformation(?ContactInformation $contactInformation): static { $this->contactInformation = $contactInformation; return $this; }}