src/Entity/QuizzQuestion.php line 13

Open in your IDE?
  1. <?php
  2.     namespace App\Entity;
  3.     use App\Repository\QuizzQuestionRepository;
  4.     use Doctrine\Common\Collections\ArrayCollection;
  5.     use Doctrine\Common\Collections\Collection;
  6.     use Doctrine\ORM\Mapping as ORM;
  7.     /**
  8.      * @ORM\Entity(repositoryClass=QuizzQuestionRepository::class)
  9.      */
  10.     class QuizzQuestion
  11.     {
  12.         /**
  13.          * @ORM\Id
  14.          * @ORM\GeneratedValue
  15.          * @ORM\Column(type="integer")
  16.          */
  17.         private $id;
  18.         /**
  19.          * @ORM\Column(type="string", length=255)
  20.          */
  21.         private $title;
  22.         /**
  23.          * @ORM\Column(type="text", nullable=true)
  24.          */
  25.         private $content;
  26.         /**
  27.          * @ORM\OneToMany(targetEntity=QuizzResponse::class, mappedBy="quizzQuestion", orphanRemoval=true)
  28.          */
  29.         private $position;
  30.         /**
  31.          * @ORM\ManyToOne(targetEntity=Quizz::class, inversedBy="questions")
  32.          * @ORM\JoinColumn(nullable=false)
  33.          */
  34.         private $quizz;
  35.         public function __construct()
  36.         {
  37.             $this->position = new ArrayCollection();
  38.         }
  39.         public function getId(): ?int
  40.         {
  41.             return $this->id;
  42.         }
  43.         public function getTitle(): ?string
  44.         {
  45.             return $this->title;
  46.         }
  47.         public function setTitlestring $title ): self
  48.         {
  49.             $this->title $title;
  50.             return $this;
  51.         }
  52.         public function getContent(): ?string
  53.         {
  54.             return $this->content;
  55.         }
  56.         public function setContent( ?string $content ): self
  57.         {
  58.             $this->content $content;
  59.             return $this;
  60.         }
  61.         /**
  62.          * @return Collection<int, QuizzResponse>
  63.          */
  64.         public function getPosition(): Collection
  65.         {
  66.             return $this->position;
  67.         }
  68.         public function addPositionQuizzResponse $position ): self
  69.         {
  70.             if ( !$this->position->contains$position ) ) {
  71.                 $this->position[] = $position;
  72.                 $position->setQuizzQuestion$this );
  73.             }
  74.             return $this;
  75.         }
  76.         public function removePositionQuizzResponse $position ): self
  77.         {
  78.             if ( $this->position->removeElement$position ) ) {
  79.                 // set the owning side to null (unless already changed)
  80.                 if ( $position->getQuizzQuestion() === $this ) {
  81.                     $position->setQuizzQuestionNULL );
  82.                 }
  83.             }
  84.             return $this;
  85.         }
  86.         public function getQuizz(): ?Quizz
  87.         {
  88.             return $this->quizz;
  89.         }
  90.         public function setQuizz( ?Quizz $quizz ): self
  91.         {
  92.             $this->quizz $quizz;
  93.             return $this;
  94.         }
  95.     }