<?php
namespace App\Entity;
use App\Enum\TipoAccionEnum;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass="App\Repository\AccionAbstractRepository")
* @ORM\Table(name="accion_abstract", schema="perseo")
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="type", type="string")
* @ORM\DiscriminatorMap({
* "estado":"App\Entity\AccionEstado",
* "ubicacion":"App\Entity\AccionUbicacion",
* "mejora":"App\Entity\AccionMejora",
* "competencia":"App\Entity\AccionCompetencia",
* "servicio":"App\Entity\AccionServicio",
* "check":"App\Entity\AccionCheck",
* "anuncio":"App\Entity\AccionAnuncio"
* })
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
*/
Abstract class AccionAbstract
{
/**
* @ORM\Id
* @ORM\Column(type="bigint", options={"unsigned":true})
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $descripcion;
/**
* @ORM\Column(type="text", nullable=true, name="descripcion_detallada")
*/
private $descripcionDetallada;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $fecha;
/**
* @ORM\Column(type="datetime", nullable=true, name="deleted_at")
*/
private $deletedAt;
/**
* @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
* @Gedmo\Timestampable(on="update")
*/
private $updatedAt;
/**
* @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
* @Gedmo\Timestampable(on="create")
*/
private $createdAt;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Promocion", inversedBy="acciones")
* @ORM\JoinColumn(name="promocion_id", referencedColumnName="id")
*/
private $promocion;
public function getId(): ?string
{
return $this->id;
}
public function getDescripcion(): ?string
{
return $this->descripcion;
}
public function setDescripcion(?string $descripcion): self
{
$this->descripcion = $descripcion;
return $this;
}
public function getDescripcionDetallada(): ?string
{
return $this->descripcionDetallada;
}
public function setDescripcionDetallada(?string $descripcionDetallada): self
{
$this->descripcionDetallada = $descripcionDetallada;
return $this;
}
public function getFecha(): ?\DateTimeInterface
{
return $this->fecha;
}
public function setFecha(?\DateTimeInterface $fecha): self
{
$this->fecha = $fecha;
return $this;
}
public function getDeletedAt(): ?\DateTimeInterface
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTimeInterface $deletedAt): self
{
$this->deletedAt = $deletedAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getPromocion(): ?Promocion
{
return $this->promocion;
}
public function setPromocion(?Promocion $promocion): self
{
$this->promocion = $promocion;
return $this;
}
public function getTipoAccion(): string
{
$tipo = '---';
switch (get_class($this))
{
case AccionAnuncio::class:
$tipo = TipoAccionEnum::ACCION_ANUNCIO;
break;
case AccionCheck::class:
$tipo = TipoAccionEnum::ACCION_CHECK;
break;
case AccionCompetencia::class:
$tipo = TipoAccionEnum::ACCION_COMPETENCIA;
break;
case AccionEstado::class:
$tipo = TipoAccionEnum::ACCION_ESTADO;
break;
case AccionMejora::class:
$tipo = TipoAccionEnum::ACCION_MEJORA;
break;
case AccionServicio::class:
$tipo = TipoAccionEnum::ACCION_SERVICIO;
break;
case AccionUbicacion::class:
$tipo = TipoAccionEnum::ACCION_UBICACION;
break;
}
return $tipo;
}
}