src/Entity/Question.php line 12
<?php
namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\QuestionRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
#[ORM\Entity(repositoryClass: QuestionRepository::class)]
class Question
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $shortName = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $question = null;
#[ORM\ManyToOne(inversedBy: 'questions')]
#[ORM\JoinColumn(nullable: false)]
private ?SubThematic $subThematic = null;
#[ORM\OneToMany(mappedBy: 'question', targetEntity: EvaluationAnswer::class)]
private Collection $evaluationAnswers;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
public function __construct()
{
$this->evaluationAnswers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getShortName(): ?string
{
return $this->shortName;
}
public function setShortName(?string $shortName): self
{
$this->shortName = $shortName;
return $this;
}
public function getQuestion(): ?string
{
return $this->question;
}
public function setQuestion(?string $question): self
{
$this->question = $question;
return $this;
}
public function getSubThematic(): ?SubThematic
{
return $this->subThematic;
}
public function setSubThematic(?SubThematic $subThematic): self
{
$this->subThematic = $subThematic;
return $this;
}
/**
* @return Collection<int, EvaluationAnswer>
*/
public function getEvaluationAnswers(): Collection
{
return $this->evaluationAnswers;
}
public function addEvaluationAnswer(EvaluationAnswer $evaluationAnswer): self
{
if (!$this->evaluationAnswers->contains($evaluationAnswer)) {
$this->evaluationAnswers->add($evaluationAnswer);
$evaluationAnswer->setQuestion($this);
}
return $this;
}
public function removeEvaluationAnswer(EvaluationAnswer $evaluationAnswer): self
{
if ($this->evaluationAnswers->removeElement($evaluationAnswer)) {
// set the owning side to null (unless already changed)
if ($evaluationAnswer->getQuestion() === $this) {
$evaluationAnswer->setQuestion(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
}