src/Entity/QueueTask.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\QueueTask\Status;
  4. use App\Repository\QueueTaskRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass=QueueTaskRepository::class)
  8.  */
  9. class QueueTask
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="enum", options={"values"="queue_task_enum"})
  19.      */
  20.     private $status Status::STATUS_NEW;
  21.     /**
  22.      * @ORM\Column(type="datetime")
  23.      */
  24.     private $createdAt;
  25.     /**
  26.      * @ORM\Column(type="text", nullable=true)
  27.      */
  28.     private $error;
  29.     public function __construct()
  30.     {
  31.         $this->createdAt = new \DateTime();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getStatus()
  38.     {
  39.         return $this->status;
  40.     }
  41.     public function setStatus($status): self
  42.     {
  43.         $this->status $status;
  44.         return $this;
  45.     }
  46.     public function getCreatedAt(): ?\DateTimeInterface
  47.     {
  48.         return $this->createdAt;
  49.     }
  50.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  51.     {
  52.         $this->createdAt $createdAt;
  53.         return $this;
  54.     }
  55.     public function isStatusTtlExceeded(): bool
  56.     {
  57.         return $this->getStatus() === Status::STATUS_TTL_EXCEEDED;
  58.     }
  59.     public function isStatusError(): bool
  60.     {
  61.         return $this->getStatus() === Status::STATUS_ERROR;
  62.     }
  63.     public function isStatusProcessing(): bool
  64.     {
  65.         return $this->getStatus() === Status::STATUS_PROCESSING;
  66.     }
  67.     public function isStatusCompleted(): bool
  68.     {
  69.         return $this->getStatus() === Status::STATUS_COMPLETED;
  70.     }
  71.     public function isStatusNew(): bool
  72.     {
  73.         return $this->getStatus() === Status::STATUS_NEW;
  74.     }
  75.     public function getError(): ?string
  76.     {
  77.         return $this->error;
  78.     }
  79.     public function setError(?string $error): self
  80.     {
  81.         $this->error $error;
  82.         return $this;
  83.     }
  84. }