src/Entity/Question.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\QuestionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=QuestionRepository::class)
  9.  */
  10. class Question
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="text")
  20.      */
  21.     private $libelle;
  22.     /**
  23.      * @ORM\Column(type="text", nullable=true)
  24.      */
  25.     private $image;
  26.     /**
  27.      * @ORM\Column(type="string", length=2)
  28.      */
  29.     private $typereponse;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=Reponse::class, mappedBy="question",cascade={"persist","remove"})
  32.      */
  33.     private $reponses;
  34.     /**
  35.      * @ORM\ManyToMany(targetEntity=Evaluation::class, mappedBy="question")
  36.      */
  37.     private $evaluations;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=ModuleSession::class, inversedBy="questions")
  40.      * @ORM\JoinColumn(nullable=false)
  41.      */
  42.     private $modulesession;
  43.      /**
  44.      * @ORM\ManyToOne(targetEntity=Formation::class)
  45.      * @ORM\JoinColumn(nullable=true)
  46.      */
  47.     private $formation;
  48.     public function __construct()
  49.     {
  50.         $this->reponses = new ArrayCollection();
  51.         $this->evaluations = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getLibelle(): ?string
  58.     {
  59.         return $this->libelle;
  60.     }
  61.     public function setLibelle(string $libelle): self
  62.     {
  63.         $this->libelle $libelle;
  64.         return $this;
  65.     }
  66.     public function getImage(): ?string
  67.     {
  68.         return $this->image;
  69.     }
  70.     public function setImage(?string $image): self
  71.     {
  72.         $this->image $image;
  73.         return $this;
  74.     }
  75.     public function getTypereponse(): ?string
  76.     {
  77.         return $this->typereponse;
  78.     }
  79.     public function setTypereponse(string $typereponse): self
  80.     {
  81.         $this->typereponse $typereponse;
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return Collection<int, Reponse>
  86.      */
  87.     public function getReponses(): Collection
  88.     {
  89.         return $this->reponses;
  90.     }
  91.     public function addReponse(Reponse $reponse): self
  92.     {
  93.         if (!$this->reponses->contains($reponse)) {
  94.             $this->reponses[] = $reponse;
  95.             $reponse->setQuestion($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeReponse(Reponse $reponse): self
  100.     {
  101.         if ($this->reponses->removeElement($reponse)) {
  102.             // set the owning side to null (unless already changed)
  103.             if ($reponse->getQuestion() === $this) {
  104.                 $reponse->setQuestion(null);
  105.             }
  106.         }
  107.         return $this;
  108.     }
  109.     /**
  110.      * @return Collection<int, Evaluation>
  111.      */
  112.     public function getEvaluations(): Collection
  113.     {
  114.         return $this->evaluations;
  115.     }
  116.     public function addEvaluation(Evaluation $evaluation): self
  117.     {
  118.         if (!$this->evaluations->contains($evaluation)) {
  119.             $this->evaluations[] = $evaluation;
  120.             $evaluation->addQuestion($this);
  121.         }
  122.         return $this;
  123.     }
  124.     public function removeEvaluation(Evaluation $evaluation): self
  125.     {
  126.         if ($this->evaluations->removeElement($evaluation)) {
  127.             $evaluation->removeQuestion($this);
  128.         }
  129.         return $this;
  130.     }
  131.     public function getModuleSession(): ?ModuleSession
  132.     {
  133.         return $this->modulesession;
  134.     }
  135.     public function setModuleSession(?ModuleSession $session): self
  136.     {
  137.         $this->modulesession $session;
  138.         return $this;
  139.     }
  140.     public function getFormation(): ?Formation
  141.     {
  142.         return $this->formation;
  143.     }
  144.     public function setFormation(?Formation $session): self
  145.     {
  146.         $this->formation $session;
  147.         return $this;
  148.     }
  149. }