<?phpnamespace App\Entity;use App\Model\Entity;use App\Repository\QuestionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;#[ORM\Entity(repositoryClass: QuestionRepository::class)]class Question extends Entity{ #[ORM\Column(length: 255)] #[Groups(['question:read'])] private ?string $question = null; #[ORM\Column(length: 50)] #[Groups(['question:read'])] private ?string $name = null; #[ORM\Column] private ?int $position = null; #[ORM\Column(length: 40)] #[Groups(['question:read'])] private ?string $answerType = null; #[ORM\Column(length: 40)] #[Groups(['question:read'])] private ?string $answerInput = null; #[ORM\Column] #[Groups(['question:read'])] private array $choices = []; #[ORM\ManyToOne(inversedBy: 'questions')] #[ORM\JoinColumn(nullable: false)] private ?ConfigurationType $type = null; #[ORM\OneToMany(mappedBy: 'currentQuestion', targetEntity: NextQuestion::class, orphanRemoval: true)] #[Groups(['question:read'])] private Collection $nextQuestions; #[ORM\OneToMany(mappedBy: 'question', targetEntity: NextQuestion::class, orphanRemoval: true)] private Collection $previousQuestions; public function __construct() { $this->nextQuestions = new ArrayCollection(); $this->previousQuestions = new ArrayCollection(); } public function getQuestion(): ?string { return $this->question; } public function setQuestion(string $question): self { $this->question = $question; return $this; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getType(): ?ConfigurationType { return $this->type; } public function setType(?ConfigurationType $type): self { $this->type = $type; return $this; } /** * @return Collection<int, NextQuestion> */ public function getNextQuestions(): Collection { return $this->nextQuestions; } public function addNextQuestion(NextQuestion $nextQuestion): self { if (!$this->nextQuestions->contains($nextQuestion)) { $this->nextQuestions->add($nextQuestion); $nextQuestion->setCurrentQuestion($this); } return $this; } public function removeNextQuestion(NextQuestion $nextQuestion): self { if ($this->nextQuestions->removeElement($nextQuestion)) { // set the owning side to null (unless already changed) if ($nextQuestion->getCurrentQuestion() === $this) { $nextQuestion->setCurrentQuestion(null); } } return $this; } /** * @return Collection<int, NextQuestion> */ public function getPreviousQuestions(): Collection { return $this->previousQuestions; } public function addPreviousQuestion(NextQuestion $previousQuestion): self { if (!$this->previousQuestions->contains($previousQuestion)) { $this->previousQuestions->add($previousQuestion); $previousQuestion->setQuestion($this); } return $this; } public function removePreviousQuestion(NextQuestion $previousQuestion): self { if ($this->previousQuestions->removeElement($previousQuestion)) { // set the owning side to null (unless already changed) if ($previousQuestion->getQuestion() === $this) { $previousQuestion->setQuestion(null); } } return $this; } public function getPosition(): ?int { return $this->position; } public function setPosition(int $position): self { $this->position = $position; return $this; } public function getAnswerType(): ?string { return $this->answerType; } public function setAnswerType(string $answerType): self { $this->answerType = $answerType; return $this; } public function getAnswerInput(): ?string { return $this->answerInput; } public function setAnswerInput(string $answerInput): self { $this->answerInput = $answerInput; return $this; } public function getChoices(): array { return $this->choices; } public function setChoices(array $choices): self { $this->choices = $choices; return $this; }}