<?phpnamespace App\Entity;use App\Repository\QuestionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=QuestionRepository::class) */class Question{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="text") */ private $libelle; /** * @ORM\Column(type="text", nullable=true) */ private $image; /** * @ORM\Column(type="string", length=2) */ private $typereponse; /** * @ORM\OneToMany(targetEntity=Reponse::class, mappedBy="question",cascade={"persist","remove"}) */ private $reponses; /** * @ORM\ManyToMany(targetEntity=Evaluation::class, mappedBy="question") */ private $evaluations; /** * @ORM\ManyToOne(targetEntity=ModuleSession::class, inversedBy="questions") * @ORM\JoinColumn(nullable=false) */ private $modulesession; /** * @ORM\ManyToOne(targetEntity=Formation::class) * @ORM\JoinColumn(nullable=true) */ private $formation; public function __construct() { $this->reponses = new ArrayCollection(); $this->evaluations = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getLibelle(): ?string { return $this->libelle; } public function setLibelle(string $libelle): self { $this->libelle = $libelle; return $this; } public function getImage(): ?string { return $this->image; } public function setImage(?string $image): self { $this->image = $image; return $this; } public function getTypereponse(): ?string { return $this->typereponse; } public function setTypereponse(string $typereponse): self { $this->typereponse = $typereponse; return $this; } /** * @return Collection<int, Reponse> */ public function getReponses(): Collection { return $this->reponses; } public function addReponse(Reponse $reponse): self { if (!$this->reponses->contains($reponse)) { $this->reponses[] = $reponse; $reponse->setQuestion($this); } return $this; } public function removeReponse(Reponse $reponse): self { if ($this->reponses->removeElement($reponse)) { // set the owning side to null (unless already changed) if ($reponse->getQuestion() === $this) { $reponse->setQuestion(null); } } return $this; } /** * @return Collection<int, Evaluation> */ public function getEvaluations(): Collection { return $this->evaluations; } public function addEvaluation(Evaluation $evaluation): self { if (!$this->evaluations->contains($evaluation)) { $this->evaluations[] = $evaluation; $evaluation->addQuestion($this); } return $this; } public function removeEvaluation(Evaluation $evaluation): self { if ($this->evaluations->removeElement($evaluation)) { $evaluation->removeQuestion($this); } return $this; } public function getModuleSession(): ?ModuleSession { return $this->modulesession; } public function setModuleSession(?ModuleSession $session): self { $this->modulesession = $session; return $this; } public function getFormation(): ?Formation { return $this->formation; } public function setFormation(?Formation $session): self { $this->formation = $session; return $this; }}