src/Entity/Configuration/Survey.php line 21

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