src/Entity/AccionEstado.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\EstadoOperacionEnum;
  4. use App\Enum\EstadoRelojEnum;
  5. use App\Enum\TipoAccionEnum;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\AccionEstadoRepository")
  10.  * @ORM\Table(name="accion_estado")
  11.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  12.  */
  13. class AccionEstado extends AccionAbstract
  14. {
  15.     /**
  16.      * @ORM\Column(type="float", nullable=true, precision=2)
  17.      */
  18.     private $precio;
  19.     /**
  20.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoReloj", inversedBy="accionesEstado")
  21.      * @ORM\JoinColumn(name="estado_reloj_id", referencedColumnName="id")
  22.      */
  23.     private $estado;
  24.     public function __toString(): string
  25.     {
  26.         return $this->getEstado()?->getNombre() ?? '---';
  27.     }
  28.     public function getPrecio(): ?float
  29.     {
  30.         return $this->precio;
  31.     }
  32.     public function setPrecio(?float $precio): self
  33.     {
  34.         $this->precio $precio;
  35.         return $this;
  36.     }
  37.     public function getEstado(): ?EstadoReloj
  38.     {
  39.         return $this->estado;
  40.     }
  41.     public function setEstado(?EstadoReloj $estado): self
  42.     {
  43.         $this->estado $estado;
  44.         return $this;
  45.     }
  46.     /**
  47.      * Comprueba si el estado es Compra
  48.      * @return bool
  49.      */
  50.     public function isPurchase(): bool
  51.     {
  52.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_COMPRA;
  53.     }
  54.     /**
  55.      * Comprueba si el estado es Gestión
  56.      * @return bool
  57.      */
  58.     public function isManagement(): bool
  59.     {
  60.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_GESTION;
  61.     }
  62.     /**
  63.      * Comprueba si el estado es Enviado
  64.      * @return bool
  65.      */
  66.     public function isSent(): bool
  67.     {
  68.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_ENVIADO;
  69.     }
  70.     /**
  71.      * Comprueba si el estado es Recepción
  72.      * @return bool
  73.      */
  74.     public function isReception(): bool
  75.     {
  76.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_RECEPCION;
  77.     }
  78.     /**
  79.      * Comprueba si el estado es En Tramitación
  80.      * @return bool
  81.      */
  82.     public function isInProcess(): bool
  83.     {
  84.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_EN_TRAMITACION;
  85.     }
  86. }