<?phpnamespace App\Core\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;/** * @ORM\Entity(repositoryClass="App\Core\Repository\CountryRepository") */class Country{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") * @Groups("main") */ private $id; /** * @ORM\Column(type="string", length=50) * @Groups("main") */ private $nombre; /** * @ORM\Column(type="string", length=3) * @Groups("main") */ private $sortname; /** * @ORM\Column(type="integer") * @Groups("main") */ private $codigoTelefonico; /** * @ORM\OneToMany(targetEntity="App\Core\Entity\State", mappedBy="country") */ private $states; public function __construct() { $this->states = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getNombre(): ?string { return $this->nombre; } public function setNombre(string $nombre): self { $this->nombre = $nombre; return $this; } public function getSortname(): ?string { return $this->sortname; } public function setSortname(string $sortname): self { $this->sortname = $sortname; return $this; } public function getCodigoTelefonico(): ?int { return $this->codigoTelefonico; } public function setCodigoTelefonico(int $codigoTelefonico): self { $this->codigoTelefonico = $codigoTelefonico; return $this; } /** * @return Collection|State[] */ public function getStates(): Collection { return $this->states; } public function addState(State $state): self { if (!$this->states->contains($state)) { $this->states[] = $state; $state->setCountry($this); } return $this; } public function removeState(State $state): self { if ($this->states->contains($state)) { $this->states->removeElement($state); // set the owning side to null (unless already changed) if ($state->getCountry() === $this) { $state->setCountry(null); } } return $this; }}