src/Entity/Configuration/Survey.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Configuration;
  3. use Doctrine\DBAL\Types\Types;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Entity\Request\RequestForm;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use App\Repository\Configuration\SurveyRepository;
  9. use Gedmo\Timestampable\Traits\TimestampableEntity;
  10. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  11. #[ORM\Entity(repositoryClassSurveyRepository::class)]
  12. #[UniqueEntity(
  13.     fields: ['refSuffix'],
  14.     errorPath'refSuffix',
  15.     message'This refSuffix is already in use',
  16. )]
  17. class Survey
  18. {
  19.     use TimestampableEntity;
  20.     #[ORM\Id]
  21.     #[ORM\GeneratedValue]
  22.     #[ORM\Column]
  23.     private ?int $id null;
  24.     #[ORM\Column(nullabletrue)]
  25.     private ?bool $isEnable null;
  26.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  27.     private ?\DateTimeInterface $deletedAt null;
  28.     #[ORM\Column(nullabletrue)]
  29.     private ?bool $isDisplay null;
  30.     #[ORM\Column(length255nullablefalseuniquetrue)]
  31.     private ?string $refSuffix;
  32.     #[ORM\OneToMany(mappedBy'survey'targetEntityOptionInSurvey::class)]
  33.     private Collection $optionInSurveys;
  34.     #[ORM\OneToMany(mappedBy'survey'targetEntityRequestForm::class, orphanRemovaltrue)]
  35.     private Collection $requestForms;
  36.     #[ORM\Column(length50nullabletrue)]
  37.     private ?string $bgColor null;
  38.     #[ORM\Column(nullabletrue)]
  39.     private ?int $position null;
  40.     #[ORM\Column(length255nullabletrue)]
  41.     private ?string $surveyColor null;
  42.  
  43.     public function __construct()
  44.     {
  45.         $this->createdAt = new \DateTime();
  46.         $this->updatedAt = new \DateTime();
  47.         $this->optionInSurveys = new ArrayCollection();
  48.         $this->requestForms = new ArrayCollection(); 
  49.     }
  50.     
  51.         public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function isIsEnable(): ?bool
  56.     {
  57.         return $this->isEnable;
  58.     }
  59.     public function setIsEnable(?bool $isEnable): self
  60.     {
  61.         $this->isEnable $isEnable;
  62.         return $this;
  63.     }
  64.     public function getDeletedAt(): ?\DateTimeInterface
  65.     {
  66.         return $this->deletedAt;
  67.     }
  68.     public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  69.     {
  70.         $this->deletedAt $deletedAt;
  71.         return $this;
  72.     }
  73.     public function isIsDisplay(): ?bool
  74.     {
  75.         return $this->isDisplay;
  76.     }
  77.     public function setIsDisplay(?bool $isDisplay): self
  78.     {
  79.         $this->isDisplay $isDisplay;
  80.         return $this;
  81.     }
  82.     public function getRefSuffix(): ?string
  83.     {
  84.         return $this->refSuffix;
  85.     }
  86.     public function setRefSuffix(?string $refSuffix): self
  87.     {
  88.         $this->refSuffix $refSuffix;
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return Collection<int, OptionInSurvey>
  93.      */
  94.     public function getOptionInSurveys(): Collection
  95.     {
  96.         return $this->optionInSurveys;
  97.     }
  98.     public function addOptionInSurvey(OptionInSurvey $optionInSurvey): self
  99.     {
  100.         if (!$this->optionInSurveys->contains($optionInSurvey)) {
  101.             $this->optionInSurveys->add($optionInSurvey);
  102.             $optionInSurvey->setSurvey($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removeOptionInSurvey(OptionInSurvey $optionInSurvey): self
  107.     {
  108.         if ($this->optionInSurveys->removeElement($optionInSurvey)) {
  109.             // set the owning side to null (unless already changed)
  110.             if ($optionInSurvey->getSurvey() === $this) {
  111.                 $optionInSurvey->setSurvey(null);
  112.             }
  113.         }
  114.         return $this;
  115.     }
  116.     /**
  117.      * @return Collection<int, RequestForm>
  118.      */
  119.     public function getRequestForms(): Collection
  120.     {
  121.         return $this->requestForms;
  122.     }
  123.     public function addRequestForm(RequestForm $requestForm): self
  124.     {
  125.         if (!$this->requestForms->contains($requestForm)) {
  126.             $this->requestForms->add($requestForm);
  127.             $requestForm->setSurvey($this);
  128.         }
  129.         return $this;
  130.     }
  131.     public function removeRequestForm(RequestForm $requestForm): self
  132.     {
  133.         if ($this->requestForms->removeElement($requestForm)) {
  134.             // set the owning side to null (unless already changed)
  135.             if ($requestForm->getSurvey() === $this) {
  136.                 $requestForm->setSurvey(null);
  137.             }
  138.         }
  139.         return $this;
  140.     }
  141.     public function getBgColor(): ?string
  142.     {
  143.         return $this->bgColor;
  144.     }
  145.     public function setBgColor(?string $bgColor): static
  146.     {
  147.         $this->bgColor $bgColor;
  148.         return $this;
  149.     }
  150.     public function getPosition(): ?int
  151.     {
  152.         return $this->position;
  153.     }
  154.     public function setPosition(?int $position): static
  155.     {
  156.         $this->position $position;
  157.         return $this;
  158.     }
  159.     public function getSurveyColor(): ?string
  160.     {
  161.         return $this->surveyColor;
  162.     }
  163.     public function setSurveyColor(?string $surveyColor): static
  164.     {
  165.         $this->surveyColor $surveyColor;
  166.         return $this;
  167.     }
  168.  
  169. }