src/Entity/QuizResult.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\QuizResultRepository")
  8.  */
  9. class QuizResult
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="bigint")
  15.      */
  16.     private $id;
  17.     
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $title;
  22.     /**
  23.      * @ORM\Column(type="text")
  24.      */
  25.     private $body;
  26.     
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity="App\Entity\Quiz", inversedBy="quizResults")
  29.      * @ORM\JoinColumn(name="quiz_id", referencedColumnName="id", onDelete="SET NULL")
  30.      */
  31.     private $quiz;
  32.     
  33.     /**
  34.      * @ORM\Column(type="integer")
  35.      */
  36.     private $sort;
  37.     /**
  38.      * @ORM\Column(type="integer")
  39.      */
  40.     private $range_min;
  41.     /**
  42.      * @ORM\Column(type="integer")
  43.      */
  44.     private $range_max;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity="App\Entity\QuizResponse", mappedBy="quizResult", orphanRemoval=true, cascade={"persist", "remove"}, fetch="EAGER")
  47.      */
  48.     private $quizResponses;
  49.     
  50.     
  51.     public function __construct ()
  52.     {
  53.         $this->title "";
  54.         $this->body "";
  55.         $this->sort 0;
  56.         $this->range_min 0;
  57.         $this->range_max 0;
  58.         $this->quizResponses = new ArrayCollection();
  59.     }
  60.     public function getId()
  61.     {
  62.         return $this->id;
  63.     }
  64.     
  65.     public function getTitle(): ?string
  66.     {
  67.         return $this->title;
  68.     }
  69.     
  70.     public function setTitle (string $title null): ?self
  71.     {
  72.         $this->title $title $title "";
  73.         return $this;
  74.     }
  75.     
  76.     public function getBody(): ?string
  77.     {
  78.         return $this->body;
  79.     }
  80.     
  81.     public function setBody (string $body null): ?self
  82.     {
  83.         $this->body $body $body "";
  84.         return $this;
  85.     }
  86.     
  87.     public function getQuiz(): ?Quiz
  88.     {
  89.         return $this->quiz;
  90.     }
  91.     
  92.     public function setQuiz(?Quiz $quiz null): self
  93.     {
  94.         $this->quiz $quiz;
  95.         return $this;
  96.     }
  97.     
  98.     public function getSort(): int
  99.     {
  100.         return $this->sort;
  101.     }
  102.     
  103.     public function setSort(int $sort): self
  104.     {
  105.         $this->sort $sort;
  106.         return $this;
  107.     }
  108.     public function getRangeMin(): int
  109.     {
  110.         return $this->range_min;
  111.     }
  112.     public function setRangeMin(int $range_min): self
  113.     {
  114.         $this->range_min $range_min;
  115.         return $this;
  116.     }
  117.     public function getRangeMax(): int
  118.     {
  119.         return $this->range_max;
  120.     }
  121.     public function setRangeMax(int $range_max): self
  122.     {
  123.         $this->range_max $range_max;
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return Collection|QuizResponse[]
  128.      */
  129.     public function getQuizResponses(): Collection
  130.     {
  131.         return $this->quizResponses;
  132.     }
  133.     
  134.     public function addQuizResponse(QuizResponse $quizResponse): self
  135.     {
  136.         if (!$this->quizResponses->contains($quizResponse)) {
  137.             $this->quizResponses[] = $quizResponse;
  138.             $quizResponse->setQuizResult($this);
  139.         }
  140.         
  141.         return $this;
  142.     }
  143.     
  144.     public function removeQuizResponse(QuizResponse $quizResponse): self
  145.     {
  146.         if ($this->quizResponses->contains($quizResponse)) {
  147.             $this->quizResponses->removeElement($quizResponse);
  148.             // set the owning side to null (unless already changed)
  149.             if ($quizResponse->getQuizResult() === $this) {
  150.                 $quizResponse->setQuizResult(null);
  151.             }
  152.         }
  153.         
  154.         return $this;
  155.     }
  156.     
  157.     
  158.     public function __toString ()
  159.     {
  160.         return $this->getTitle();
  161.     }
  162.     
  163. }