<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\QuizResultRepository")
*/
class QuizResult
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="bigint")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\Column(type="text")
*/
private $body;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Quiz", inversedBy="quizResults")
* @ORM\JoinColumn(name="quiz_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $quiz;
/**
* @ORM\Column(type="integer")
*/
private $sort;
/**
* @ORM\Column(type="integer")
*/
private $range_min;
/**
* @ORM\Column(type="integer")
*/
private $range_max;
/**
* @ORM\OneToMany(targetEntity="App\Entity\QuizResponse", mappedBy="quizResult", orphanRemoval=true, cascade={"persist", "remove"}, fetch="EAGER")
*/
private $quizResponses;
public function __construct ()
{
$this->title = "";
$this->body = "";
$this->sort = 0;
$this->range_min = 0;
$this->range_max = 0;
$this->quizResponses = new ArrayCollection();
}
public function getId()
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle (string $title = null): ?self
{
$this->title = $title ? $title : "";
return $this;
}
public function getBody(): ?string
{
return $this->body;
}
public function setBody (string $body = null): ?self
{
$this->body = $body ? $body : "";
return $this;
}
public function getQuiz(): ?Quiz
{
return $this->quiz;
}
public function setQuiz(?Quiz $quiz = null): self
{
$this->quiz = $quiz;
return $this;
}
public function getSort(): int
{
return $this->sort;
}
public function setSort(int $sort): self
{
$this->sort = $sort;
return $this;
}
public function getRangeMin(): int
{
return $this->range_min;
}
public function setRangeMin(int $range_min): self
{
$this->range_min = $range_min;
return $this;
}
public function getRangeMax(): int
{
return $this->range_max;
}
public function setRangeMax(int $range_max): self
{
$this->range_max = $range_max;
return $this;
}
/**
* @return Collection|QuizResponse[]
*/
public function getQuizResponses(): Collection
{
return $this->quizResponses;
}
public function addQuizResponse(QuizResponse $quizResponse): self
{
if (!$this->quizResponses->contains($quizResponse)) {
$this->quizResponses[] = $quizResponse;
$quizResponse->setQuizResult($this);
}
return $this;
}
public function removeQuizResponse(QuizResponse $quizResponse): self
{
if ($this->quizResponses->contains($quizResponse)) {
$this->quizResponses->removeElement($quizResponse);
// set the owning side to null (unless already changed)
if ($quizResponse->getQuizResult() === $this) {
$quizResponse->setQuizResult(null);
}
}
return $this;
}
public function __toString ()
{
return $this->getTitle();
}
}