src/Entity/Gos/CancellationForm.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Repository\Gos\CancellationFormRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CancellationFormRepository::class)
  9.  */
  10. class CancellationForm
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity=CancellationQuestion::class, mappedBy="cancellationForm")
  24.      */
  25.     private $cancellationQuestions;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=CancellationFormAnswer::class, mappedBy="cancellationForm")
  28.      */
  29.     private $cancellationFormAnswers;
  30.     /**
  31.      * @ORM\Column(type="text", nullable=true)
  32.      */
  33.     private $finalPageContent;
  34.     public function __construct()
  35.     {
  36.         $this->cancellationQuestions = new ArrayCollection();
  37.         $this->cancellationFormAnswers = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(string $name): self
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection|CancellationQuestion[]
  54.      */
  55.     public function getCancellationQuestions(): Collection
  56.     {
  57.         return $this->cancellationQuestions;
  58.     }
  59.     /**
  60.      * @return CancellationQuestion[]
  61.      */
  62.     public function getSortedCancellationQuestions(): array
  63.     {
  64.         $questions $this->getCancellationQuestions()->toArray();
  65.         usort($questions, static function($a$b) {
  66.             return $a->getPosition() <=> $b->getPosition();
  67.         });
  68.         return $questions;
  69.     }
  70.     public function addCancellationQuestion(CancellationQuestion $cancellationQuestion): self
  71.     {
  72.         if (!$this->cancellationQuestions->contains($cancellationQuestion)) {
  73.             $this->cancellationQuestions[] = $cancellationQuestion;
  74.             $cancellationQuestion->setCancellationForm($this);
  75.         }
  76.         return $this;
  77.     }
  78.     public function removeCancellationQuestion(CancellationQuestion $cancellationQuestion): self
  79.     {
  80.         if ($this->cancellationQuestions->contains($cancellationQuestion)) {
  81.             $this->cancellationQuestions->removeElement($cancellationQuestion);
  82.             // set the owning side to null (unless already changed)
  83.             if ($cancellationQuestion->getCancellationForm() === $this) {
  84.                 $cancellationQuestion->setCancellationForm(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection|CancellationFormAnswer[]
  91.      */
  92.     public function getCancellationFormAnswers(): Collection
  93.     {
  94.         return $this->cancellationFormAnswers;
  95.     }
  96.     public function addCancellationFormAnswer(CancellationFormAnswer $cancellationFormAnswer): self
  97.     {
  98.         if (!$this->cancellationFormAnswers->contains($cancellationFormAnswer)) {
  99.             $this->cancellationFormAnswers[] = $cancellationFormAnswer;
  100.             $cancellationFormAnswer->setCancellationForm($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removeCancellationFormAnswer(CancellationFormAnswer $cancellationFormAnswer): self
  105.     {
  106.         if ($this->cancellationFormAnswers->contains($cancellationFormAnswer)) {
  107.             $this->cancellationFormAnswers->removeElement($cancellationFormAnswer);
  108.             // set the owning side to null (unless already changed)
  109.             if ($cancellationFormAnswer->getCancellationForm() === $this) {
  110.                 $cancellationFormAnswer->setCancellationForm(null);
  111.             }
  112.         }
  113.         return $this;
  114.     }
  115.     public function getFinalPageContent(): ?string
  116.     {
  117.         return $this->finalPageContent;
  118.     }
  119.     public function setFinalPageContent(?string $finalPageContent): self
  120.     {
  121.         $this->finalPageContent $finalPageContent;
  122.         return $this;
  123.     }
  124. }