<?phpnamespace App\Entity;use App\Repository\NumeroCompetenciaRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=NumeroCompetenciaRepository::class) * @ORM\Table(name="numeroCompetencia",indexes={@ORM\Index(name="numero_idx", columns={"numero"})})) */class NumeroCompetencia{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=5) */ private $numero; /** * @ORM\ManyToOne(targetEntity=Sorteo::class, inversedBy="numeroCompetencias", cascade={"persist"}) * @ORM\JoinColumn(nullable=false) */ private $sorteo; /** * @ORM\OneToMany(targetEntity=NumeroSede::class, mappedBy="numeroCompetencia", orphanRemoval=true) */ private $numeroSedes; public function __construct() { $this->numeroSedes = new ArrayCollection(); } public function __toString(): string { return $this->getNombre(); } public function getId(): ?int { return $this->id; } public function getNumero(): ?string { return $this->numero; } public function setNumero(string $numero): self { $this->numero = $numero; return $this; } public function getSorteo(): ?Sorteo { return $this->sorteo; } public function setSorteo(?Sorteo $sorteo): self { $this->sorteo = $sorteo; return $this; } /** * @return Collection<int, NumeroSede> */ public function getNumeroSedes(): Collection { return $this->numeroSedes; } public function addNumeroSede(NumeroSede $numeroSede): self { if (!$this->numeroSedes->contains($numeroSede)) { $this->numeroSedes[] = $numeroSede; $numeroSede->setNumeroCompetencia($this); } return $this; } public function removeNumeroSede(NumeroSede $numeroSede): self { if ($this->numeroSedes->removeElement($numeroSede)) { // set the owning side to null (unless already changed) if ($numeroSede->getNumeroCompetencia() === $this) { $numeroSede->setNumeroCompetencia(null); } } return $this; }}