src/Entity/Sorteo.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SorteoRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=SorteoRepository::class)
  9.  * @ORM\Table(name="sorteo")
  10.  */
  11. class Sorteo
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=200)
  21.      */
  22.     private $nombre;
  23.     /**
  24.      * @ORM\Column(type="integer")
  25.      */
  26.     private $anno;
  27.     /**
  28.      * @ORM\Column(type="date")
  29.      */
  30.     private $fecha;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=Numeracion::class, mappedBy="sorteo", orphanRemoval=true, cascade={"persist", "remove"})
  33.      */
  34.     private $numeraciones;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=NumeroCompetencia::class, mappedBy="sorteo", orphanRemoval=true)
  37.      */
  38.     private $numeroCompetencias;
  39.     public function __construct()
  40.     {
  41.         $this->numeraciones = new ArrayCollection();
  42.         $this->numeroCompetencias = new ArrayCollection();
  43.     }
  44.     public function __toString(): string
  45.     {
  46.         return $this->getNombre();
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getNombre(): ?string
  53.     {
  54.         return $this->nombre;
  55.     }
  56.     public function setNombre(string $nombre): self
  57.     {
  58.         $this->nombre $nombre;
  59.         return $this;
  60.     }
  61.     public function getAnno(): ?int
  62.     {
  63.         return $this->anno;
  64.     }
  65.     public function setAnno(int $anno): self
  66.     {
  67.         $this->anno $anno;
  68.         return $this;
  69.     }
  70.     public function getFecha(): ?\DateTimeInterface
  71.     {
  72.         return $this->fecha;
  73.     }
  74.     public function setFecha(\DateTimeInterface $fecha): self
  75.     {
  76.         $this->fecha $fecha;
  77.         return $this;
  78.     }
  79.     /**
  80.      * @return Collection<int, Numeracion>
  81.      */
  82.     public function getNumeraciones(): Collection
  83.     {
  84.         return $this->numeraciones;
  85.     }
  86.     public function addNumeracion(Numeracion $numeracion): self
  87.     {
  88.         if (!$this->numeraciones->contains($numeracion)) {
  89.             $this->numeraciones[] = $numeracion;
  90.             $numeracion->setSorteo($this);
  91.         }
  92.         return $this;
  93.     }
  94.     public function removeNumeracion(Numeracion $numeracion): self
  95.     {
  96.         if ($this->numeraciones->removeElement($numeracion)) {
  97.             // set the owning side to null (unless already changed)
  98.             if ($numeracion->getSorteo() === $this) {
  99.                 $numeracion->setSorteo(null);
  100.             }
  101.         }
  102.         return $this;
  103.     }
  104.     /**
  105.      * @return Collection<int, NumeroCompetencia>
  106.      */
  107.     public function getNumeroCompetencias(): Collection
  108.     {
  109.         return $this->numeroCompetencias;
  110.     }
  111.     public function addNumeroCompetencia(NumeroCompetencia $numeroCompetencia): self
  112.     {
  113.         if (!$this->numeroCompetencias->contains($numeroCompetencia)) {
  114.             $this->numeroCompetencias[] = $numeroCompetencia;
  115.             $numeroCompetencia->setSorteo($this);
  116.         }
  117.         return $this;
  118.     }
  119.     public function removeNumeroCompetencia(NumeroCompetencia $numeroCompetencia): self
  120.     {
  121.         if ($this->numeroCompetencias->removeElement($numeroCompetencia)) {
  122.             // set the owning side to null (unless already changed)
  123.             if ($numeroCompetencia->getSorteo() === $this) {
  124.                 $numeroCompetencia->setSorteo(null);
  125.             }
  126.         }
  127.         return $this;
  128.     }
  129. }