src/Entity/NumeroCompetencia.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NumeroCompetenciaRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=NumeroCompetenciaRepository::class)
  9.  * @ORM\Table(name="numeroCompetencia",indexes={@ORM\Index(name="numero_idx", columns={"numero"})}))
  10.  */
  11. class NumeroCompetencia
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=5)
  21.      */
  22.     private $numero;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity=Sorteo::class, inversedBy="numeroCompetencias", cascade={"persist"})
  25.      * @ORM\JoinColumn(nullable=false)
  26.      */
  27.     private $sorteo;
  28.     /**
  29.      * @ORM\OneToMany(targetEntity=NumeroSede::class, mappedBy="numeroCompetencia", orphanRemoval=true)
  30.      */
  31.     private $numeroSedes;
  32.     public function __construct()
  33.     {
  34.         $this->numeroSedes = new ArrayCollection();
  35.     }
  36.     public function __toString(): string
  37.     {
  38.         return $this->getNombre();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getNumero(): ?string
  45.     {
  46.         return $this->numero;
  47.     }
  48.     public function setNumero(string $numero): self
  49.     {
  50.         $this->numero $numero;
  51.         return $this;
  52.     }
  53.     public function getSorteo(): ?Sorteo
  54.     {
  55.         return $this->sorteo;
  56.     }
  57.     public function setSorteo(?Sorteo $sorteo): self
  58.     {
  59.         $this->sorteo $sorteo;
  60.         return $this;
  61.     }
  62.     /**
  63.      * @return Collection<int, NumeroSede>
  64.      */
  65.     public function getNumeroSedes(): Collection
  66.     {
  67.         return $this->numeroSedes;
  68.     }
  69.     public function addNumeroSede(NumeroSede $numeroSede): self
  70.     {
  71.         if (!$this->numeroSedes->contains($numeroSede)) {
  72.             $this->numeroSedes[] = $numeroSede;
  73.             $numeroSede->setNumeroCompetencia($this);
  74.         }
  75.         return $this;
  76.     }
  77.     public function removeNumeroSede(NumeroSede $numeroSede): self
  78.     {
  79.         if ($this->numeroSedes->removeElement($numeroSede)) {
  80.             // set the owning side to null (unless already changed)
  81.             if ($numeroSede->getNumeroCompetencia() === $this) {
  82.                 $numeroSede->setNumeroCompetencia(null);
  83.             }
  84.         }
  85.         return $this;
  86.     }
  87. }