src/Entity/Configuration/Option.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Configuration;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Repository\Configuration\OptionRepository;
  8. use Gedmo\Timestampable\Traits\TimestampableEntity;
  9. #[ORM\Entity(repositoryClassOptionRepository::class)]
  10. #[ORM\Table(name'`option`')]
  11. class Option
  12. {
  13.     use TimestampableEntity;
  14.     const TYPE_RADIO "radio";
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  20.     private ?\DateTimeInterface $deletedAt null;
  21.     #[ORM\Column(nullabletrue)]
  22.     private ?bool $isEnable null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $type null;
  25.     #[ORM\OneToMany(mappedBy'relatedOption'targetEntityOptionValue::class, orphanRemovaltrue)]
  26.     private Collection $optionValues;
  27.     #[ORM\OneToMany(mappedBy'relatedOption'targetEntityOptionInSurvey::class, orphanRemovaltrue)]
  28.     private Collection $optionInSurveys;
  29.     public function __construct()
  30.     {
  31.         $this->createdAt = new \DateTime();
  32.         $this->updatedAt = new \DateTime();
  33.         $this->optionValues = new ArrayCollection();
  34.         $this->optionInSurveys = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getDeletedAt(): ?\DateTimeInterface
  41.     {
  42.         return $this->deletedAt;
  43.     }
  44.     public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  45.     {
  46.         $this->deletedAt $deletedAt;
  47.         return $this;
  48.     }
  49.     public function isIsEnable(): ?bool
  50.     {
  51.         return $this->isEnable;
  52.     }
  53.     public function setIsEnable(?bool $isEnable): self
  54.     {
  55.         $this->isEnable $isEnable;
  56.         return $this;
  57.     }
  58.     public function getType(): ?string
  59.     {
  60.         return $this->type;
  61.     }
  62.     public function setType(?string $type): self
  63.     {
  64.         $this->type $type;
  65.         return $this;
  66.     }
  67.     /**
  68.      * @return Collection<int, OptionValue>
  69.      */
  70.     public function getOptionValues(): Collection
  71.     {
  72.         return $this->optionValues;
  73.     }
  74.     public function addOptionValue(OptionValue $optionValue): self
  75.     {
  76.         if (!$this->optionValues->contains($optionValue)) {
  77.             $this->optionValues->add($optionValue);
  78.             $optionValue->setRelatedOption($this);
  79.         }
  80.         return $this;
  81.     }
  82.     public function removeOptionValue(OptionValue $optionValue): self
  83.     {
  84.         if ($this->optionValues->removeElement($optionValue)) {
  85.             // set the owning side to null (unless already changed)
  86.             if ($optionValue->getRelatedOption() === $this) {
  87.                 $optionValue->setRelatedOption(null);
  88.             }
  89.         }
  90.         return $this;
  91.     }
  92.     /**
  93.      * @return Collection<int, OptionInSurvey>
  94.      */
  95.     public function getOptionInSurveys(): Collection
  96.     {
  97.         return $this->optionInSurveys;
  98.     }
  99.     public function addOptionInSurvey(OptionInSurvey $optionInSurvey): self
  100.     {
  101.         if (!$this->optionInSurveys->contains($optionInSurvey)) {
  102.             $this->optionInSurveys->add($optionInSurvey);
  103.             $optionInSurvey->setRelatedOption($this);
  104.         }
  105.         return $this;
  106.     }
  107.     public function removeOptionInSurvey(OptionInSurvey $optionInSurvey): self
  108.     {
  109.         if ($this->optionInSurveys->removeElement($optionInSurvey)) {
  110.             // set the owning side to null (unless already changed)
  111.             if ($optionInSurvey->getRelatedOption() === $this) {
  112.                 $optionInSurvey->setRelatedOption(null);
  113.             }
  114.         }
  115.         return $this;
  116.     }
  117. }