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\Column(type="float", nullable=true, precision=2)
  21.      */
  22.     private $coste;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoReloj", inversedBy="accionesEstado")
  25.      * @ORM\JoinColumn(name="estado_reloj_id", referencedColumnName="id")
  26.      */
  27.     private $estado;
  28.     public function __toString(): string
  29.     {
  30.         return $this->getEstado()?->getNombre() ?? '---';
  31.     }
  32.     public function getPrecio(): ?float
  33.     {
  34.         return $this->precio;
  35.     }
  36.     public function setPrecio(?float $precio): self
  37.     {
  38.         $this->precio $precio;
  39.         return $this;
  40.     }
  41.     public function getEstado(): ?EstadoReloj
  42.     {
  43.         return $this->estado;
  44.     }
  45.     public function setEstado(?EstadoReloj $estado): self
  46.     {
  47.         $this->estado $estado;
  48.         return $this;
  49.     }
  50.     /**
  51.      * Comprueba si el estado es Compra
  52.      * @return bool
  53.      */
  54.     public function isPurchase(): bool
  55.     {
  56.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_COMPRA;
  57.     }
  58.     /**
  59.      * Comprueba si el estado es Gestión
  60.      * @return bool
  61.      */
  62.     public function isManagement(): bool
  63.     {
  64.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_GESTION;
  65.     }
  66.     /**
  67.      * Comprueba si el estado es Enviado
  68.      * @return bool
  69.      */
  70.     public function isSent(): bool
  71.     {
  72.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_ENVIADO;
  73.     }
  74.     /**
  75.      * Comprueba si el estado es Recepción
  76.      * @return bool
  77.      */
  78.     public function isReception(): bool
  79.     {
  80.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_RECEPCION;
  81.     }
  82.     /**
  83.      * Comprueba si el estado es En Tramitación
  84.      * @return bool
  85.      */
  86.     public function isInProcess(): bool
  87.     {
  88.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_EN_TRAMITACION;
  89.     }
  90.     public function isImport(): bool
  91.     {
  92.         return $this->getEstado()->getKey() === EstadoRelojEnum::ESTADO_IMPORTACION;
  93.     }
  94.     public function getCoste(): ?float
  95.     {
  96.         return $this->coste;
  97.     }
  98.     public function setCoste(?float $coste): static
  99.     {
  100.         $this->coste $coste;
  101.         return $this;
  102.     }
  103. }