<?phpnamespace App\Entity;use App\Repository\CountryRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\UX\Turbo\Attribute\Broadcast;#[ORM\Entity(repositoryClass: CountryRepository::class)]#[Broadcast]class Country{ use IdentifiableTrait; #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\Column(length: 255)] private ?string $code = null; #[ORM\OneToMany(mappedBy: 'country', targetEntity: Commercial::class)] private Collection $commercials; #[ORM\OneToMany(mappedBy: 'country', targetEntity: Prescriber::class)] private Collection $prescribers; public function __construct() { $this->commercials = new ArrayCollection(); $this->prescribers = 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 getCode(): ?string { return $this->code; } public function setCode(string $code): self { $this->code = $code; return $this; } /** * @return Collection<int, Commercial> */ public function getCommercials(): Collection { return $this->commercials; } public function addCommercial(Commercial $commercial): self { if (!$this->commercials->contains($commercial)) { $this->commercials->add($commercial); $commercial->setCountry($this); } return $this; } public function removeCommercial(Commercial $commercial): self { if ($this->commercials->removeElement($commercial)) { // set the owning side to null (unless already changed) if ($commercial->getCountry() === $this) { $commercial->setCountry(null); } } 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->setCountry($this); } return $this; } public function removePrescriber(Prescriber $prescriber): self { if ($this->prescribers->removeElement($prescriber)) { // set the owning side to null (unless already changed) if ($prescriber->getCountry() === $this) { $prescriber->setCountry(null); } } return $this; }}