<?phpnamespace App\Entity;use App\Repository\HospitalCategoryRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=HospitalCategoryRepository::class) */class HospitalCategory{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $wording; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $description; /** * @ORM\Column(type="datetime") */ private $updateAt; /** * @ORM\OneToMany(targetEntity=Hospital::class, mappedBy="hospitalCategory") */ private $hospitals; public function __construct() { $this->hospitals = new ArrayCollection(); $this->__updateDate(); } public function getId(): ?int { return $this->id; } public function getWording(): ?string { return $this->wording; } public function setWording(string $wording): self { $this->wording = $wording; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } public function getUpdateAt(): ?\DateTimeInterface { return $this->updateAt; } public function setUpdateAt(\DateTimeInterface $updateAt): self { $this->updateAt = $updateAt; return $this; } /** * @return Collection|Hospital[] */ public function getHospitals(): Collection { return $this->hospitals; } public function addHospital(Hospital $hospital): self { if (!$this->hospitals->contains($hospital)) { $this->hospitals[] = $hospital; $hospital->setHospitalCategory($this); } return $this; } public function removeHospital(Hospital $hospital): self { if ($this->hospitals->removeElement($hospital)) { // set the owning side to null (unless already changed) if ($hospital->getHospitalCategory() === $this) { $hospital->setHospitalCategory(null); } } return $this; } public function __toString() { return $this->getWording(); } /** * @ORM\PreUpdate */ public function __updateDate() { $this->setUpdateAt(new \DateTime()); }}