src/Entity/AccionAbstract.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\TipoAccionEnum;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\AccionAbstractRepository")
  9.  * @ORM\Table(name="accion_abstract", schema="perseo")
  10.  * @ORM\InheritanceType("SINGLE_TABLE")
  11.  * @ORM\DiscriminatorColumn(name="type", type="string")
  12.  * @ORM\DiscriminatorMap({
  13.  *     "estado":"App\Entity\AccionEstado",
  14.  *     "ubicacion":"App\Entity\AccionUbicacion",
  15.  *     "mejora":"App\Entity\AccionMejora",
  16.  *     "competencia":"App\Entity\AccionCompetencia",
  17.  *     "servicio":"App\Entity\AccionServicio",
  18.  *     "check":"App\Entity\AccionCheck",
  19.  *     "anuncio":"App\Entity\AccionAnuncio"
  20.  * })
  21.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  22.  */
  23. Abstract class AccionAbstract
  24. {
  25.     /**
  26.      * @ORM\Id
  27.      * @ORM\Column(type="bigint", options={"unsigned":true})
  28.      * @ORM\GeneratedValue(strategy="AUTO")
  29.      */
  30.     private $id;
  31.     /**
  32.      * @ORM\Column(type="string", nullable=true)
  33.      */
  34.     private $descripcion;
  35.     /**
  36.      * @ORM\Column(type="text", nullable=true, name="descripcion_detallada")
  37.      */
  38.     private $descripcionDetallada;
  39.     /**
  40.      * @ORM\Column(type="datetime", nullable=true)
  41.      */
  42.     private $fecha;
  43.     /**
  44.      * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  45.      */
  46.     private $deletedAt;
  47.     /**
  48.      * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  49.      * @Gedmo\Timestampable(on="update")
  50.      */
  51.     private $updatedAt;
  52.     /**
  53.      * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  54.      * @Gedmo\Timestampable(on="create")
  55.      */
  56.     private $createdAt;
  57.     /**
  58.      * @ORM\ManyToOne(targetEntity="App\Entity\Promocion", inversedBy="acciones")
  59.      * @ORM\JoinColumn(name="promocion_id", referencedColumnName="id")
  60.      */
  61.     private $promocion;
  62.     public function getId(): ?string
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getDescripcion(): ?string
  67.     {
  68.         return $this->descripcion;
  69.     }
  70.     public function setDescripcion(?string $descripcion): self
  71.     {
  72.         $this->descripcion $descripcion;
  73.         return $this;
  74.     }
  75.     public function getDescripcionDetallada(): ?string
  76.     {
  77.         return $this->descripcionDetallada;
  78.     }
  79.     public function setDescripcionDetallada(?string $descripcionDetallada): self
  80.     {
  81.         $this->descripcionDetallada $descripcionDetallada;
  82.         return $this;
  83.     }
  84.     public function getFecha(): ?\DateTimeInterface
  85.     {
  86.         return $this->fecha;
  87.     }
  88.     public function setFecha(?\DateTimeInterface $fecha): self
  89.     {
  90.         $this->fecha $fecha;
  91.         return $this;
  92.     }
  93.     public function getDeletedAt(): ?\DateTimeInterface
  94.     {
  95.         return $this->deletedAt;
  96.     }
  97.     public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  98.     {
  99.         $this->deletedAt $deletedAt;
  100.         return $this;
  101.     }
  102.     public function getUpdatedAt(): ?\DateTimeInterface
  103.     {
  104.         return $this->updatedAt;
  105.     }
  106.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  107.     {
  108.         $this->updatedAt $updatedAt;
  109.         return $this;
  110.     }
  111.     public function getCreatedAt(): ?\DateTimeInterface
  112.     {
  113.         return $this->createdAt;
  114.     }
  115.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  116.     {
  117.         $this->createdAt $createdAt;
  118.         return $this;
  119.     }
  120.     public function getPromocion(): ?Promocion
  121.     {
  122.         return $this->promocion;
  123.     }
  124.     public function setPromocion(?Promocion $promocion): self
  125.     {
  126.         $this->promocion $promocion;
  127.         return $this;
  128.     }
  129.     public function getTipoAccion(): string
  130.     {
  131.         $tipo '---';
  132.         switch (get_class($this))
  133.         {
  134.             case AccionAnuncio::class:
  135.                 $tipo TipoAccionEnum::ACCION_ANUNCIO;
  136.                 break;
  137.             case AccionCheck::class:
  138.                 $tipo TipoAccionEnum::ACCION_CHECK;
  139.                 break;
  140.             case AccionCompetencia::class:
  141.                 $tipo TipoAccionEnum::ACCION_COMPETENCIA;
  142.                 break;
  143.             case AccionEstado::class:
  144.                 $tipo TipoAccionEnum::ACCION_ESTADO;
  145.                 break;
  146.             case AccionMejora::class:
  147.                 $tipo TipoAccionEnum::ACCION_MEJORA;
  148.                 break;
  149.             case AccionServicio::class:
  150.                 $tipo TipoAccionEnum::ACCION_SERVICIO;
  151.                 break;
  152.             case AccionUbicacion::class:
  153.                 $tipo TipoAccionEnum::ACCION_UBICACION;
  154.                 break;
  155.         }
  156.         return $tipo;
  157.     }
  158. }