<?php
namespace App\Entity\Configuration;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use App\Repository\Configuration\OptionValueRepository;
#[ORM\Entity(repositoryClass: OptionValueRepository::class)]
class OptionValue
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(nullable: true)]
private ?bool $isEnable = null;
#[ORM\Column(nullable: true)]
private ?bool $isOther = null;
#[ORM\Column(nullable: true)]
private ?bool $hasDescription = null;
#[ORM\Column(nullable: true)]
private ?bool $hasFile = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $onClickColorBg = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $onClickColorText = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $deletedAt = null;
#[ORM\ManyToOne(inversedBy: 'optionValues')]
#[ORM\JoinColumn(nullable: false)]
private ?Option $relatedOption = null;
#[ORM\OneToMany(mappedBy: 'optionValue', targetEntity: ValueInSurvey::class, orphanRemoval: true)]
private Collection $valueInSurveys;
public function __construct()
{
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
$this->valueInSurveys = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function isIsEnable(): ?bool
{
return $this->isEnable;
}
public function setIsEnable(?bool $isEnable): self
{
$this->isEnable = $isEnable;
return $this;
}
public function isIsOther(): ?bool
{
return $this->isOther;
}
public function setIsOther(?bool $isOther): self
{
$this->isOther = $isOther;
return $this;
}
public function isHasDescription(): ?bool
{
return $this->hasDescription;
}
public function setHasDescription(?bool $hasDescription): self
{
$this->hasDescription = $hasDescription;
return $this;
}
public function isHasFile(): ?bool
{
return $this->hasFile;
}
public function setHasFile(?bool $hasFile): self
{
$this->hasFile = $hasFile;
return $this;
}
public function getOnClickColorBg(): ?string
{
return $this->onClickColorBg;
}
public function setOnClickColorBg(?string $onClickColorBg): self
{
$this->onClickColorBg = $onClickColorBg;
return $this;
}
public function getOnClickColorText(): ?string
{
return $this->onClickColorText;
}
public function setOnClickColorText(?string $onClickColorText): self
{
$this->onClickColorText = $onClickColorText;
return $this;
}
public function getDeletedAt(): ?\DateTimeInterface
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTimeInterface $deletedAt): self
{
$this->deletedAt = $deletedAt;
return $this;
}
public function getRelatedOption(): ?Option
{
return $this->relatedOption;
}
public function setRelatedOption(?Option $relatedOption): self
{
$this->relatedOption = $relatedOption;
return $this;
}
/**
* @return Collection<int, ValueInSurvey>
*/
public function getValueInSurveys(): Collection
{
return $this->valueInSurveys;
}
public function addValueInSurvey(ValueInSurvey $valueInSurvey): self
{
if (!$this->valueInSurveys->contains($valueInSurvey)) {
$this->valueInSurveys->add($valueInSurvey);
$valueInSurvey->setOptionValue($this);
}
return $this;
}
public function removeValueInSurvey(ValueInSurvey $valueInSurvey): self
{
if ($this->valueInSurveys->removeElement($valueInSurvey)) {
// set the owning side to null (unless already changed)
if ($valueInSurvey->getOptionValue() === $this) {
$valueInSurvey->setOptionValue(null);
}
}
return $this;
}
}