<?php
namespace App\Entity\Configuration;
use App\Entity\Request\RequestDetails;
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\ValueInSurveyRepository;
#[ORM\Entity(repositoryClass: ValueInSurveyRepository::class)]
class ValueInSurvey
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'valueInSurveys')]
#[ORM\JoinColumn(nullable: false)]
private ?OptionValue $optionValue = null;
#[ORM\ManyToOne(inversedBy: 'valueInSurveys')]
#[ORM\JoinColumn(nullable: false)]
private ?OptionInSurvey $optionInSurvey = null;
#[ORM\Column(nullable: true)]
private ?int $position = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $deletedAt = null;
#[ORM\Column(nullable: true)]
private ?bool $isEnable = null;
#[ORM\Column(nullable: true)]
private ?bool $isDisplay = true;
#[ORM\OneToMany(mappedBy: 'choosenValueInSurvey', targetEntity: ConditionnedOption::class, orphanRemoval: true)]
private Collection $conditionnedOptions;
#[ORM\OneToMany(mappedBy: 'valueInSurvey', targetEntity: RequestDetails::class, orphanRemoval: true)]
private Collection $requestDetails;
public function __construct()
{
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
$this->conditionnedOptions = new ArrayCollection();
$this->requestDetails = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getOptionValue(): ?OptionValue
{
return $this->optionValue;
}
public function setOptionValue(?OptionValue $optionValue): self
{
$this->optionValue = $optionValue;
return $this;
}
public function getOptionInSurvey(): ?OptionInSurvey
{
return $this->optionInSurvey;
}
public function setOptionInSurvey(?OptionInSurvey $optionInSurvey): self
{
$this->optionInSurvey = $optionInSurvey;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): self
{
$this->position = $position;
return $this;
}
public function getDeletedAt(): ?\DateTimeInterface
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTimeInterface $deletedAt): self
{
$this->deletedAt = $deletedAt;
return $this;
}
public function isIsEnable(): ?bool
{
return $this->isEnable;
}
public function setIsEnable(?bool $isEnable): self
{
$this->isEnable = $isEnable;
return $this;
}
public function isIsDisplay(): ?bool
{
return $this->isDisplay;
}
public function setIsDisplay(?bool $isDisplay): self
{
$this->isDisplay = $isDisplay;
return $this;
}
/**
* @return Collection<int, ConditionnedOption>
*/
public function getConditionnedOptions(): Collection
{
return $this->conditionnedOptions;
}
public function addConditionnedOption(ConditionnedOption $conditionnedOption): self
{
if (!$this->conditionnedOptions->contains($conditionnedOption)) {
$this->conditionnedOptions->add($conditionnedOption);
$conditionnedOption->setChoosenValueInSurvey($this);
}
return $this;
}
public function removeConditionnedOption(ConditionnedOption $conditionnedOption): self
{
if ($this->conditionnedOptions->removeElement($conditionnedOption)) {
// set the owning side to null (unless already changed)
if ($conditionnedOption->getChoosenValueInSurvey() === $this) {
$conditionnedOption->setChoosenValueInSurvey(null);
}
}
return $this;
}
/**
* @return Collection<int, RequestDetails>
*/
public function getRequestDetails(): Collection
{
return $this->requestDetails;
}
public function addRequestDetail(RequestDetails $requestDetail): self
{
if (!$this->requestDetails->contains($requestDetail)) {
$this->requestDetails->add($requestDetail);
$requestDetail->setValueInSurvey($this);
}
return $this;
}
public function removeRequestDetail(RequestDetails $requestDetail): self
{
if ($this->requestDetails->removeElement($requestDetail)) {
// set the owning side to null (unless already changed)
if ($requestDetail->getValueInSurvey() === $this) {
$requestDetail->setValueInSurvey(null);
}
}
return $this;
}
}