<?phpnamespace App\Entity;use App\Repository\SpecialtyRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: SpecialtyRepository::class)]class Specialty{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $description = null; #[ORM\Column(length: 255, nullable: true)] private ?string $code = null; #[ORM\Column] private ?\DateTimeImmutable $createdAt = null; #[ORM\ManyToMany(targetEntity: Doctor::class, mappedBy: 'specialties')] private Collection $doctors; public function __construct() { $this->doctors = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): static { $this->description = $description; return $this; } public function getCode(): ?string { return $this->code; } public function setCode(?string $code): static { $this->code = $code; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): static { $this->createdAt = $createdAt; return $this; } /** * @return Collection<int, Doctor> */ public function getDoctors(): Collection { return $this->doctors; } public function addDoctor(Doctor $doctor): static { if (!$this->doctors->contains($doctor)) { $this->doctors->add($doctor); $doctor->addSpecialty($this); } return $this; } public function removeDoctor(Doctor $doctor): static { if ($this->doctors->removeElement($doctor)) { $doctor->removeSpecialty($this); } return $this; }}