<?php
namespace App\Entity;
use App\Repository\ExerciseSimpleAnswerRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ExerciseSimpleAnswerRepository::class)
*/
class ExerciseSimpleAnswer
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=32)
*/
private $name;
/**
* @ORM\Column(type="text")
*/
private $description;
/**
* @ORM\Column(type="text")
*/
private $question;
/**
* @ORM\Column(type="string", length=32)
*/
private $answer;
/**
* @ORM\Column(type="integer")
*/
private $position;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $note;
/**
* @ORM\ManyToOne(targetEntity=Kpi::class, inversedBy="exerciseSimpleAnswers")
* @ORM\JoinColumn(nullable=false)
*/
private $kpi;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $played;
/**
* @ORM\OneToMany(targetEntity=ExerciseSimpleAnswerResult::class, mappedBy="exercise")
*/
private $results;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $evaluationModel;
public function __construct()
{
if(is_null($this->played)){
$this->setPlayed(0);
}
if(is_null($this->position)){
$this->setPosition(0);
}
$this->results = 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;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getQuestion(): ?string
{
return $this->question;
}
public function setQuestion(string $question): self
{
$this->question = $question;
return $this;
}
public function getAnswer(): ?string
{
return $this->answer;
}
public function setAnswer(string $answer): self
{
$this->answer = $answer;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(int $position): self
{
$this->position = $position;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getKpi(): ?Kpi
{
return $this->kpi;
}
public function setKpi(?Kpi $kpi): self
{
$this->kpi = $kpi;
return $this;
}
public function getPlayed(): ?int
{
return $this->played;
}
public function setPlayed(?int $played): self
{
$this->played = $played;
return $this;
}
public function incrementPlayed(): self
{
$this->played++;
return $this;
}
/**
* @return Collection|ExerciseSimpleAnswerResult[]
*/
public function getResults(): Collection
{
return $this->results;
}
public function addResult(ExerciseSimpleAnswerResult $result): self
{
if (!$this->results->contains($result)) {
$this->results[] = $result;
$result->setExercise($this);
}
return $this;
}
public function removeResult(ExerciseSimpleAnswerResult $result): self
{
if ($this->results->removeElement($result)) {
// set the owning side to null (unless already changed)
if ($result->getExercise() === $this) {
$result->setExercise(null);
}
}
return $this;
}
public function getEvaluationModel(): ?string
{
return $this->evaluationModel;
}
public function setEvaluationModel(?string $evaluationModel): self
{
$this->evaluationModel = $evaluationModel;
return $this;
}
}