src/Entity/QuizResultat.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\QuizResultatRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. #[ORM\Entity(repositoryClassQuizResultatRepository::class)]
  9. class QuizResultat
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\OneToMany(mappedBy'quizResultat'targetEntityQuizMention::class, cascade: ['persist''remove'])]
  16.     #[Assert\Valid]
  17.     private Collection $mention;
  18.     
  19.     #[ORM\ManyToOne(inversedBy'quizResultats')]
  20.     #[ORM\JoinColumn(nullablefalse)]
  21.     #[Assert\NotNull]
  22.     private ?Quiz $quiz null;
  23.     #[ORM\Column]
  24.     private ?bool $selected null;
  25.     public function __construct()
  26.     {
  27.         $this->mention = new ArrayCollection();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     /**
  34.      * @return Collection<int, QuizMention>
  35.      */
  36.     public function getMention(): Collection
  37.     {
  38.         return $this->mention;
  39.     }
  40.     public function addMention(QuizMention $mention): self
  41.     {
  42.         if (!$this->mention->contains($mention)) {
  43.             $this->mention->add($mention);
  44.         }
  45.         return $this;
  46.     }
  47.     public function removeMention(QuizMention $mention): self
  48.     {
  49.         if ($this->mention->removeElement($mention)) {
  50.             // set the owning side to null (unless already changed)
  51.             if ($mention->getQuizResultat() === $this) {
  52.                 $mention->setQuizResultat(null);
  53.             }
  54.         }
  55.         return $this;
  56.     }
  57.     public function getQuiz(): ?Quiz
  58.     {
  59.         return $this->quiz;
  60.     }
  61.     public function setQuiz(?Quiz $quiz): self
  62.     {
  63.         $this->quiz $quiz;
  64.         return $this;
  65.     }
  66.     public function isSelected(): ?bool
  67.     {
  68.         return $this->selected;
  69.     }
  70.     public function setSelected(bool $selected): self
  71.     {
  72.         $this->selected $selected;
  73.         return $this;
  74.     }
  75. }