src/Entity/Request/RequestStatus.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Request;
  3. use App\Entity\TemplateEmail\Template;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use App\Repository\Request\RequestStatusRepository;
  9. use Gedmo\Timestampable\Traits\TimestampableEntity;
  10. #[ORM\Entity(repositoryClassRequestStatusRepository::class)]
  11. class RequestStatus
  12. {
  13.     use TimestampableEntity;
  14.     const TYPE_REQUEST_STATUS_TO_DO "to_do";
  15.     const TYPE_REQUEST_STATUS_IN_PROGRESS "in_progress";
  16.     const TYPE_REQUEST_STATUS_COMPLETED "completed";
  17.     const TYPE_REQUEST_STATUS_REJECT "reject";
  18.     const LIST_TYPE = [
  19.         self::TYPE_REQUEST_STATUS_TO_DO => self::TYPE_REQUEST_STATUS_TO_DO,
  20.         //self::TYPE_REQUEST_STATUS_IN_PROGRESS => self::TYPE_REQUEST_STATUS_IN_PROGRESS,
  21.         self::TYPE_REQUEST_STATUS_COMPLETED => self::TYPE_REQUEST_STATUS_COMPLETED,
  22.         //self::TYPE_REQUEST_STATUS_REJECT => self::TYPE_REQUEST_STATUS_REJECT,
  23.     ];
  24.     #[ORM\Id]
  25.     #[ORM\GeneratedValue]
  26.     #[ORM\Column]
  27.     private ?int $id null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $type null;
  30.     #[ORM\Column(nullabletrue)]
  31.     private ?bool $isEnable null;
  32.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  33.     private ?\DateTimeInterface $deletedAt null;
  34.     #[ORM\OneToMany(mappedBy'requestStatus'targetEntityRequestForm::class, orphanRemovaltrue)]
  35.     private Collection $requestForms;
  36.     #[ORM\OneToMany(mappedBy'requestStatus'targetEntityRequestHistory::class, orphanRemovaltrue)]
  37.     private Collection $requestHistories;
  38.     #[ORM\Column(length50nullabletrue)]
  39.     private ?string $bgColor null;
  40.     #[ORM\Column(length50nullabletrue)]
  41.     private ?string $textColor null;
  42.     #[ORM\OneToMany(mappedBy'requestStatus'targetEntityTemplate::class)]
  43.     private Collection $templates;
  44.     public function __construct()
  45.     {
  46.         $this->createdAt = new \DateTime();
  47.         $this->updatedAt = new \DateTime();
  48.         $this->requestForms = new ArrayCollection();
  49.         $this->requestHistories = new ArrayCollection();
  50.         $this->templates = new ArrayCollection();
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getType(): ?string
  57.     {
  58.         return $this->type;
  59.     }
  60.     public function setType(?string $type): self
  61.     {
  62.         $this->type $type;
  63.         return $this;
  64.     }
  65.     public function isIsEnable(): ?bool
  66.     {
  67.         return $this->isEnable;
  68.     }
  69.     public function setIsEnable(?bool $isEnable): self
  70.     {
  71.         $this->isEnable $isEnable;
  72.         return $this;
  73.     }
  74.     public function getDeletedAt(): ?\DateTimeInterface
  75.     {
  76.         return $this->deletedAt;
  77.     }
  78.     public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  79.     {
  80.         $this->deletedAt $deletedAt;
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection<int, RequestForm>
  85.      */
  86.     public function getRequestForms(): Collection
  87.     {
  88.         return $this->requestForms;
  89.     }
  90.     public function addRequestForm(RequestForm $requestForm): self
  91.     {
  92.         if (!$this->requestForms->contains($requestForm)) {
  93.             $this->requestForms->add($requestForm);
  94.             $requestForm->setRequestStatus($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeRequestForm(RequestForm $requestForm): self
  99.     {
  100.         if ($this->requestForms->removeElement($requestForm)) {
  101.             // set the owning side to null (unless already changed)
  102.             if ($requestForm->getRequestStatus() === $this) {
  103.                 $requestForm->setRequestStatus(null);
  104.             }
  105.         }
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return Collection<int, RequestHistory>
  110.      */
  111.     public function getRequestHistories(): Collection
  112.     {
  113.         return $this->requestHistories;
  114.     }
  115.     public function addRequestHistory(RequestHistory $requestHistory): self
  116.     {
  117.         if (!$this->requestHistories->contains($requestHistory)) {
  118.             $this->requestHistories->add($requestHistory);
  119.             $requestHistory->setRequestStatus($this);
  120.         }
  121.         return $this;
  122.     }
  123.     public function removeRequestHistory(RequestHistory $requestHistory): self
  124.     {
  125.         if ($this->requestHistories->removeElement($requestHistory)) {
  126.             // set the owning side to null (unless already changed)
  127.             if ($requestHistory->getRequestStatus() === $this) {
  128.                 $requestHistory->setRequestStatus(null);
  129.             }
  130.         }
  131.         return $this;
  132.     }
  133.     public function getBgColor(): ?string
  134.     {
  135.         return $this->bgColor;
  136.     }
  137.     public function setBgColor(?string $bgColor): self
  138.     {
  139.         $this->bgColor $bgColor;
  140.         return $this;
  141.     }
  142.     public function getTextColor(): ?string
  143.     {
  144.         return $this->textColor;
  145.     }
  146.     public function setTextColor(?string $textColor): self
  147.     {
  148.         $this->textColor $textColor;
  149.         return $this;
  150.     }
  151.     /**
  152.      * @return Collection<int, Template>
  153.      */
  154.     public function getTemplates(): Collection
  155.     {
  156.         return $this->templates;
  157.     }
  158.     public function addTemplate(Template $template): self
  159.     {
  160.         if (!$this->templates->contains($template)) {
  161.             $this->templates->add($template);
  162.             $template->setRequestStatus($this);
  163.         }
  164.         return $this;
  165.     }
  166.     public function removeTemplate(Template $template): self
  167.     {
  168.         if ($this->templates->removeElement($template)) {
  169.             // set the owning side to null (unless already changed)
  170.             if ($template->getRequestStatus() === $this) {
  171.                 $template->setRequestStatus(null);
  172.             }
  173.         }
  174.         return $this;
  175.     }
  176. }