src/Entity/Canal.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JMS\Serializer\Annotation as JMS;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. /**
  10.  * @ORM\Entity(repositoryClass="App\Repository\CanalRepository")
  11.  * @ORM\Table(name="canal")
  12.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  13.  */
  14. class Canal
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\Column(type="bigint", options={"unsigned":true})
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      * @JMS\Groups({
  21.      *     "api_v1_canal_serialize",
  22.      *     "api_v1_valoracion_serialize",
  23.      *     "api_v1_operacion_list_serialize",
  24.      *     "api_v1_operacion_show_serialize"
  25.      *  })
  26.      */
  27.     protected $id;
  28.     /**
  29.      * @ORM\Column(type="string", nullable=false)
  30.      * @JMS\Groups({
  31.      *      "api_v1_canal_serialize",
  32.      *      "api_v1_valoracion_serialize",
  33.      *      "api_v1_operacion_list_serialize",
  34.      *      "api_v1_operacion_show_serialize"
  35.      *   })
  36.      */
  37.     protected $nombre;
  38.     /**
  39.      * @ORM\Column(type="float", nullable=true, precision=2, options={"default": "0.00"})
  40.      * @JMS\Groups({
  41.      *       "api_v1_valoracion_serialize",
  42.      *       "api_v1_canal_serialize"
  43.      *   })
  44.      */
  45.     protected $comision;
  46.     /**
  47.      * @ORM\Column(type="string", nullable=true)
  48.      */
  49.     protected $descripcion;
  50.     /**
  51.      * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  52.      * @JMS\Groups({
  53.      *      "api_v1_canal_serialize",
  54.      *      "api_v1_valoracion_serialize",
  55.      *      "api_v1_operacion_list_serialize",
  56.      *      "api_v1_operacion_show_serialize"
  57.      *   })
  58.      */
  59.     protected $deletedAt;
  60.     /**
  61.      * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  62.      * @Gedmo\Timestampable(on="update")
  63.      */
  64.     protected $updatedAt;
  65.     /**
  66.      * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  67.      * @Gedmo\Timestampable(on="create")
  68.      */
  69.     protected $createdAt;
  70.     /**
  71.      * @ORM\OneToMany(targetEntity="App\Entity\Valoracion", mappedBy="canal")
  72.      */
  73.     protected $valoraciones;
  74.     /**
  75.      * @ORM\OneToMany(targetEntity="App\Entity\Referencia", mappedBy="canal")
  76.      */
  77.     protected $referencias;
  78.     /**
  79.      * @ORM\OneToMany(targetEntity=\App\Entity\ValoracionesRelojesStock::class, mappedBy="plataformaPromocion")
  80.      */
  81.     private $valoracionesRelojesStocks;
  82.     /**
  83.      * @ORM\OneToMany(targetEntity=\App\Entity\AccionCompetencia::class, mappedBy="canal")
  84.      */
  85.     protected $accionesCompetencia;
  86.     /**
  87.      * @ORM\OneToMany(targetEntity="App\Entity\AccionAnuncio", mappedBy="canal")
  88.      */
  89.     protected $accionesAnuncio;
  90.     /**
  91.      * @ORM\OneToMany(targetEntity=\App\Entity\ActividadAbstract::class, mappedBy="canal")
  92.      */
  93.     private $actividades;
  94.     /**
  95.      * @ORM\OneToMany(targetEntity="App\Entity\Operacion", mappedBy="canal")
  96.      */
  97.     protected $operaciones;
  98.     public function __construct()
  99.     {
  100.         $this->referencias = new ArrayCollection();
  101.         $this->operaciones = new ArrayCollection();
  102.         $this->valoraciones = new ArrayCollection();
  103.         $this->accionesCompetencia = new ArrayCollection();
  104.         $this->accionesAnuncio = new ArrayCollection();
  105.         $this->actividades = new ArrayCollection();
  106.         $this->valoracionesRelojesStocks = new ArrayCollection();
  107.     }
  108.     public function __toString(): string
  109.     {
  110.         return $this->getNombre()??'---';
  111.     }
  112.     public function getId(): ?string
  113.     {
  114.         return $this->id;
  115.     }
  116.     public function getNombre(): ?string
  117.     {
  118.         return $this->nombre;
  119.     }
  120.     public function setNombre(string $nombre): self
  121.     {
  122.         $this->nombre $nombre;
  123.         return $this;
  124.     }
  125.     public function getComision(): ?float
  126.     {
  127.         return $this->comision;
  128.     }
  129.     public function setComision(float $comision): self
  130.     {
  131.         $this->comision $comision;
  132.         return $this;
  133.     }
  134.     public function getDeletedAt(): ?\DateTimeInterface
  135.     {
  136.         return $this->deletedAt;
  137.     }
  138.     public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  139.     {
  140.         $this->deletedAt $deletedAt;
  141.         return $this;
  142.     }
  143.     public function getUpdatedAt(): ?\DateTimeInterface
  144.     {
  145.         return $this->updatedAt;
  146.     }
  147.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  148.     {
  149.         $this->updatedAt $updatedAt;
  150.         return $this;
  151.     }
  152.     public function getCreatedAt(): ?\DateTimeInterface
  153.     {
  154.         return $this->createdAt;
  155.     }
  156.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  157.     {
  158.         $this->createdAt $createdAt;
  159.         return $this;
  160.     }
  161.     /**
  162.      * @return Collection|Promocion[]
  163.      */
  164.     public function getPromociones(): Collection
  165.     {
  166.         return $this->promociones;
  167.     }
  168.     public function addPromocione(Promocion $promocione): self
  169.     {
  170.         if (!$this->promociones->contains($promocione)) {
  171.             $this->promociones[] = $promocione;
  172.             $promocione->setCanal($this);
  173.         }
  174.         return $this;
  175.     }
  176.     public function removePromocione(Promocion $promocione): self
  177.     {
  178.         if ($this->promociones->removeElement($promocione)) {
  179.             // set the owning side to null (unless already changed)
  180.             if ($promocione->getCanal() === $this) {
  181.                 $promocione->setCanal(null);
  182.             }
  183.         }
  184.         return $this;
  185.     }
  186.     /**
  187.      * @return Collection|Referencia[]
  188.      */
  189.     public function getReferencias(): Collection
  190.     {
  191.         return $this->referencias;
  192.     }
  193.     public function addReferencia(Referencia $referencia): self
  194.     {
  195.         if (!$this->referencias->contains($referencia)) {
  196.             $this->referencias[] = $referencia;
  197.             $referencia->setCanal($this);
  198.         }
  199.         return $this;
  200.     }
  201.     public function removeReferencia(Referencia $referencia): self
  202.     {
  203.         if ($this->referencias->removeElement($referencia)) {
  204.             // set the owning side to null (unless already changed)
  205.             if ($referencia->getCanal() === $this) {
  206.                 $referencia->setCanal(null);
  207.             }
  208.         }
  209.         return $this;
  210.     }
  211.     /**
  212.      * @return Collection|Operacion[]
  213.      */
  214.     public function getOperaciones(): Collection
  215.     {
  216.         return $this->operaciones;
  217.     }
  218.     public function addOperacione(Operacion $operacione): self
  219.     {
  220.         if (!$this->operaciones->contains($operacione)) {
  221.             $this->operaciones[] = $operacione;
  222.             $operacione->setCanal($this);
  223.         }
  224.         return $this;
  225.     }
  226.     public function removeOperacione(Operacion $operacione): self
  227.     {
  228.         if ($this->operaciones->removeElement($operacione)) {
  229.             // set the owning side to null (unless already changed)
  230.             if ($operacione->getCanal() === $this) {
  231.                 $operacione->setCanal(null);
  232.             }
  233.         }
  234.         return $this;
  235.     }
  236.     /**
  237.      * @return Collection|Valoracion[]
  238.      */
  239.     public function getValoraciones(): Collection
  240.     {
  241.         return $this->valoraciones;
  242.     }
  243.     public function addValoracione(Valoracion $valoracione): self
  244.     {
  245.         if (!$this->valoraciones->contains($valoracione)) {
  246.             $this->valoraciones[] = $valoracione;
  247.             $valoracione->setCanal($this);
  248.         }
  249.         return $this;
  250.     }
  251.     public function removeValoracione(Valoracion $valoracione): self
  252.     {
  253.         if ($this->valoraciones->removeElement($valoracione)) {
  254.             // set the owning side to null (unless already changed)
  255.             if ($valoracione->getCanal() === $this) {
  256.                 $valoracione->setCanal(null);
  257.             }
  258.         }
  259.         return $this;
  260.     }
  261.     public function getDescripcion(): ?string
  262.     {
  263.         return $this->descripcion;
  264.     }
  265.     public function setDescripcion(?string $descripcion): self
  266.     {
  267.         $this->descripcion $descripcion;
  268.         return $this;
  269.     }
  270.     /**
  271.      * @return Collection<int, AccionCompetencia>
  272.      */
  273.     public function getAccionesCompetencia(): Collection
  274.     {
  275.         return $this->accionesCompetencia;
  276.     }
  277.     public function addAccionesCompetencium(AccionCompetencia $accionesCompetencium): self
  278.     {
  279.         if (!$this->accionesCompetencia->contains($accionesCompetencium)) {
  280.             $this->accionesCompetencia->add($accionesCompetencium);
  281.             $accionesCompetencium->setCanal($this);
  282.         }
  283.         return $this;
  284.     }
  285.     public function removeAccionesCompetencium(AccionCompetencia $accionesCompetencium): self
  286.     {
  287.         if ($this->accionesCompetencia->removeElement($accionesCompetencium)) {
  288.             // set the owning side to null (unless already changed)
  289.             if ($accionesCompetencium->getCanal() === $this) {
  290.                 $accionesCompetencium->setCanal(null);
  291.             }
  292.         }
  293.         return $this;
  294.     }
  295.     /**
  296.      * @return Collection<int, AccionAnuncio>
  297.      */
  298.     public function getAccionesAnuncio(): Collection
  299.     {
  300.         return $this->accionesAnuncio;
  301.     }
  302.     public function addAccionesAnuncio(AccionAnuncio $accionesAnuncio): self
  303.     {
  304.         if (!$this->accionesAnuncio->contains($accionesAnuncio)) {
  305.             $this->accionesAnuncio->add($accionesAnuncio);
  306.             $accionesAnuncio->setCanal($this);
  307.         }
  308.         return $this;
  309.     }
  310.     public function removeAccionesAnuncio(AccionAnuncio $accionesAnuncio): self
  311.     {
  312.         if ($this->accionesAnuncio->removeElement($accionesAnuncio)) {
  313.             // set the owning side to null (unless already changed)
  314.             if ($accionesAnuncio->getCanal() === $this) {
  315.                 $accionesAnuncio->setCanal(null);
  316.             }
  317.         }
  318.         return $this;
  319.     }
  320.     /**
  321.      * @return Collection<int, ActividadAbstract>
  322.      */
  323.     public function getActividades(): Collection
  324.     {
  325.         return $this->actividades;
  326.     }
  327.     public function addActividade(ActividadAbstract $actividade): static
  328.     {
  329.         if (!$this->actividades->contains($actividade)) {
  330.             $this->actividades->add($actividade);
  331.             $actividade->setCanal($this);
  332.         }
  333.         return $this;
  334.     }
  335.     public function removeActividade(ActividadAbstract $actividade): static
  336.     {
  337.         if ($this->actividades->removeElement($actividade)) {
  338.             // set the owning side to null (unless already changed)
  339.             if ($actividade->getCanal() === $this) {
  340.                 $actividade->setCanal(null);
  341.             }
  342.         }
  343.         return $this;
  344.     }
  345.     /**
  346.      * @return Collection<int, ValoracionesRelojesStock>
  347.      */
  348.     public function getValoracionesRelojesStocks(): Collection
  349.     {
  350.         return $this->valoracionesRelojesStocks;
  351.     }
  352.     public function addValoracionesRelojesStock(ValoracionesRelojesStock $valoracionesRelojesStock): static
  353.     {
  354.         if (!$this->valoracionesRelojesStocks->contains($valoracionesRelojesStock)) {
  355.             $this->valoracionesRelojesStocks->add($valoracionesRelojesStock);
  356.             $valoracionesRelojesStock->setPlataformaPromocion($this);
  357.         }
  358.         return $this;
  359.     }
  360.     public function removeValoracionesRelojesStock(ValoracionesRelojesStock $valoracionesRelojesStock): static
  361.     {
  362.         if ($this->valoracionesRelojesStocks->removeElement($valoracionesRelojesStock)) {
  363.             // set the owning side to null (unless already changed)
  364.             if ($valoracionesRelojesStock->getPlataformaPromocion() === $this) {
  365.                 $valoracionesRelojesStock->setPlataformaPromocion(null);
  366.             }
  367.         }
  368.         return $this;
  369.     }
  370. }