src/Entity/Actuv2Quiz.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTimeInterface;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Repository\Actuv2QuizRepository;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. /**
  10.  * Actuv2Quiz
  11.  *
  12.  * @Vich\Uploadable
  13.  */
  14. #[ORM\Table(name'actuv2_quiz')]
  15. #[ORM\Entity(repositoryClassActuv2QuizRepository::class)]
  16. class Actuv2Quiz
  17. {
  18.     /**
  19.      * @var int
  20.      *
  21.      */
  22.     #[ORM\Column(name'id'type'bigint'nullablefalse)]
  23.     #[ORM\Id]
  24.     #[ORM\GeneratedValue(strategy'IDENTITY')]
  25.     private $id;
  26.     #[ORM\Column(name'date'type'date'nullabletrueoptions: ['comment' => 'pĂ©riode'])]
  27.     private $date;
  28.     #[ORM\Column(name'question'type'text'nullablefalse)]
  29.     private $question;
  30.     #[ORM\Column(name'detail'type'text'nullablefalse)]
  31.     private $detail;
  32.     #[ORM\OneToMany(targetEntityActuv2QuizAnswer::class, mappedBy'quiz'orphanRemovaltruecascade: ['persist''remove'])]
  33.     private $answers;
  34.     #[ORM\Column(type'datetime'nullabletrue)]
  35.     private $updatedAt;
  36.     public function __construct()
  37.     {
  38.         $this->answers = new ArrayCollection();
  39.     }
  40.     public function getId(): ?string
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getDate(): ?DateTimeInterface
  45.     {
  46.         return $this->date;
  47.     }
  48.     public function setDate(?\DateTimeInterface $date): self
  49.     {
  50.         $this->date $date;
  51.         return $this;
  52.     }
  53.     public function getUpdatedAt(): ?\DateTimeInterface
  54.     {
  55.         return $this->updatedAt;
  56.     }
  57.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  58.     {
  59.         $this->updatedAt $updatedAt;
  60.         return $this;
  61.     }
  62.     public function getQuestion(): ?string
  63.     {
  64.         return $this->question;
  65.     }
  66.     public function setQuestion(?string $question): self
  67.     {
  68.         $this->question $question;
  69.         return $this;
  70.     }
  71.     public function getDetail(): ?string
  72.     {
  73.         return $this->detail;
  74.     }
  75.     public function setDetail(?string $detail): self
  76.     {
  77.         $this->detail $detail;
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection|Actuv2QuizAnswer[]
  82.     */
  83.     public function getAnswers(): ?Collection
  84.     {
  85.         return $this->answers;
  86.     }
  87.     public function addAnswers(Actuv2QuizAnswer $answers): self
  88.     {
  89.         if (!$this->answers->contains($answers)) {
  90.             $this->answers[] = $answers;
  91.             $answers->setQuiz($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeAnswers(Actuv2QuizAnswer $answers): self
  96.     {
  97.         if ($this->answers->removeElement($answers)) {
  98.             if ($answers->getQuiz() === $this) {
  99.                 $answers->setQuiz(null);
  100.             }
  101.         }
  102.         return $this;
  103.     }
  104. }