<?phpnamespace App\Entity;use App\Repository\PrescriberSpecialityRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: PrescriberSpecialityRepository::class)]class PrescriberSpeciality{ use IdentifiableTrait; #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\Column(length: 255)] private ?string $slug = null; #[ORM\ManyToMany(targetEntity: Prescriber::class, mappedBy: 'specialities')] private Collection $prescribers; #[ORM\OneToMany(mappedBy: 'mainSpeciality', targetEntity: Prescriber::class)] private Collection $prescribersByMainSpeciality; public function __construct() { $this->prescribers = new ArrayCollection(); $this->prescribersByMainSpeciality = new ArrayCollection(); } public function __toString(): string { return $this->name; } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getSlug(): ?string { return $this->slug; } public function setSlug(string $slug): self { $this->slug = $slug; return $this; } /** * @return Collection<int, Prescriber> */ public function getPrescribers(): Collection { return $this->prescribers; } public function addPrescriber(Prescriber $prescriber): self { if (!$this->prescribers->contains($prescriber)) { $this->prescribers->add($prescriber); $prescriber->addSpeciality($this); } return $this; } public function removePrescriber(Prescriber $prescriber): self { if ($this->prescribers->removeElement($prescriber)) { $prescriber->removeSpeciality($this); } return $this; } /** * @return Collection<int, Prescriber> */ public function getPrescribersByMainSpeciality(): Collection { return $this->prescribersByMainSpeciality; } public function addPrescribersByMainSpeciality(Prescriber $prescribersByMainSpeciality): self { if (!$this->prescribersByMainSpeciality->contains($prescribersByMainSpeciality)) { $this->prescribersByMainSpeciality->add($prescribersByMainSpeciality); $prescribersByMainSpeciality->setMainSpeciality($this); } return $this; } public function removePrescribersByMainSpeciality(Prescriber $prescribersByMainSpeciality): self { if ($this->prescribersByMainSpeciality->removeElement($prescribersByMainSpeciality)) { // set the owning side to null (unless already changed) if ($prescribersByMainSpeciality->getMainSpeciality() === $this) { $prescribersByMainSpeciality->setMainSpeciality(null); } } return $this; }}