src/Entity/ExerciseSimpleAnswer.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ExerciseSimpleAnswerRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ExerciseSimpleAnswerRepository::class)
  9.  */
  10. class ExerciseSimpleAnswer
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=32)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="text")
  24.      */
  25.     private $description;
  26.     /**
  27.      * @ORM\Column(type="text")
  28.      */
  29.     private $question;
  30.     /**
  31.      * @ORM\Column(type="string", length=32)
  32.      */
  33.     private $answer;
  34.     /**
  35.      * @ORM\Column(type="integer")
  36.      */
  37.     private $position;
  38.     /**
  39.      * @ORM\Column(type="text", nullable=true)
  40.      */
  41.     private $note;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=Kpi::class, inversedBy="exerciseSimpleAnswers")
  44.      * @ORM\JoinColumn(nullable=false)
  45.      */
  46.     private $kpi;
  47.     /**
  48.      * @ORM\Column(type="integer", nullable=true)
  49.      */
  50.     private $played;
  51.     /**
  52.      * @ORM\OneToMany(targetEntity=ExerciseSimpleAnswerResult::class, mappedBy="exercise")
  53.      */
  54.     private $results;
  55.     /**
  56.      * @ORM\Column(type="text", nullable=true)
  57.      */
  58.     private $evaluationModel;
  59.     public function __construct()
  60.     {
  61.         if(is_null($this->played)){
  62.             $this->setPlayed(0);
  63.         }
  64.         if(is_null($this->position)){
  65.             $this->setPosition(0);
  66.         }
  67.         $this->results = new ArrayCollection();
  68.     }
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getName(): ?string
  74.     {
  75.         return $this->name;
  76.     }
  77.     public function setName(string $name): self
  78.     {
  79.         $this->name $name;
  80.         return $this;
  81.     }
  82.     public function getDescription(): ?string
  83.     {
  84.         return $this->description;
  85.     }
  86.     public function setDescription(string $description): self
  87.     {
  88.         $this->description $description;
  89.         return $this;
  90.     }
  91.     public function getQuestion(): ?string
  92.     {
  93.         return $this->question;
  94.     }
  95.     public function setQuestion(string $question): self
  96.     {
  97.         $this->question $question;
  98.         return $this;
  99.     }
  100.     public function getAnswer(): ?string
  101.     {
  102.         return $this->answer;
  103.     }
  104.     public function setAnswer(string $answer): self
  105.     {
  106.         $this->answer $answer;
  107.         return $this;
  108.     }
  109.     public function getPosition(): ?int
  110.     {
  111.         return $this->position;
  112.     }
  113.     public function setPosition(int $position): self
  114.     {
  115.         $this->position $position;
  116.         return $this;
  117.     }
  118.     public function getNote(): ?string
  119.     {
  120.         return $this->note;
  121.     }
  122.     public function setNote(?string $note): self
  123.     {
  124.         $this->note $note;
  125.         return $this;
  126.     }
  127.     public function getKpi(): ?Kpi
  128.     {
  129.         return $this->kpi;
  130.     }
  131.     public function setKpi(?Kpi $kpi): self
  132.     {
  133.         $this->kpi $kpi;
  134.         return $this;
  135.     }
  136.     public function getPlayed(): ?int
  137.     {
  138.         return $this->played;
  139.     }
  140.     public function setPlayed(?int $played): self
  141.     {
  142.         $this->played $played;
  143.         return $this;
  144.     }
  145.     public function incrementPlayed(): self
  146.     {
  147.         $this->played++;
  148.         return $this;
  149.     }
  150.     /**
  151.      * @return Collection|ExerciseSimpleAnswerResult[]
  152.      */
  153.     public function getResults(): Collection
  154.     {
  155.         return $this->results;
  156.     }
  157.     public function addResult(ExerciseSimpleAnswerResult $result): self
  158.     {
  159.         if (!$this->results->contains($result)) {
  160.             $this->results[] = $result;
  161.             $result->setExercise($this);
  162.         }
  163.         return $this;
  164.     }
  165.     public function removeResult(ExerciseSimpleAnswerResult $result): self
  166.     {
  167.         if ($this->results->removeElement($result)) {
  168.             // set the owning side to null (unless already changed)
  169.             if ($result->getExercise() === $this) {
  170.                 $result->setExercise(null);
  171.             }
  172.         }
  173.         return $this;
  174.     }
  175.     public function getEvaluationModel(): ?string
  176.     {
  177.         return $this->evaluationModel;
  178.     }
  179.     public function setEvaluationModel(?string $evaluationModel): self
  180.     {
  181.         $this->evaluationModel $evaluationModel;
  182.         return $this;
  183.     }
  184. }