<?phpnamespace App\Entity\Gos;use App\Repository\Gos\CancellationFormRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=CancellationFormRepository::class) */class CancellationForm{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\OneToMany(targetEntity=CancellationQuestion::class, mappedBy="cancellationForm") */ private $cancellationQuestions; /** * @ORM\OneToMany(targetEntity=CancellationFormAnswer::class, mappedBy="cancellationForm") */ private $cancellationFormAnswers; /** * @ORM\Column(type="text", nullable=true) */ private $finalPageContent; public function __construct() { $this->cancellationQuestions = new ArrayCollection(); $this->cancellationFormAnswers = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } /** * @return Collection|CancellationQuestion[] */ public function getCancellationQuestions(): Collection { return $this->cancellationQuestions; } /** * @return CancellationQuestion[] */ public function getSortedCancellationQuestions(): array { $questions = $this->getCancellationQuestions()->toArray(); usort($questions, static function($a, $b) { return $a->getPosition() <=> $b->getPosition(); }); return $questions; } public function addCancellationQuestion(CancellationQuestion $cancellationQuestion): self { if (!$this->cancellationQuestions->contains($cancellationQuestion)) { $this->cancellationQuestions[] = $cancellationQuestion; $cancellationQuestion->setCancellationForm($this); } return $this; } public function removeCancellationQuestion(CancellationQuestion $cancellationQuestion): self { if ($this->cancellationQuestions->contains($cancellationQuestion)) { $this->cancellationQuestions->removeElement($cancellationQuestion); // set the owning side to null (unless already changed) if ($cancellationQuestion->getCancellationForm() === $this) { $cancellationQuestion->setCancellationForm(null); } } return $this; } /** * @return Collection|CancellationFormAnswer[] */ public function getCancellationFormAnswers(): Collection { return $this->cancellationFormAnswers; } public function addCancellationFormAnswer(CancellationFormAnswer $cancellationFormAnswer): self { if (!$this->cancellationFormAnswers->contains($cancellationFormAnswer)) { $this->cancellationFormAnswers[] = $cancellationFormAnswer; $cancellationFormAnswer->setCancellationForm($this); } return $this; } public function removeCancellationFormAnswer(CancellationFormAnswer $cancellationFormAnswer): self { if ($this->cancellationFormAnswers->contains($cancellationFormAnswer)) { $this->cancellationFormAnswers->removeElement($cancellationFormAnswer); // set the owning side to null (unless already changed) if ($cancellationFormAnswer->getCancellationForm() === $this) { $cancellationFormAnswer->setCancellationForm(null); } } return $this; } public function getFinalPageContent(): ?string { return $this->finalPageContent; } public function setFinalPageContent(?string $finalPageContent): self { $this->finalPageContent = $finalPageContent; return $this; }}