<?phpnamespace App\Entity;use App\Repository\QuizMentionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: QuizMentionRepository::class)]class QuizMention{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $mention = null; #[ORM\Column] #[Assert\LessThan(propertyPath: "pourcentageMax")] #[Assert\Range( min: 0, max: 100, notInRangeMessage: 'Pourcentage doit étre entre {{ min }} et {{ max }}', )] private ?float $pourcentage = null; #[ORM\Column] #[Assert\GreaterThan(propertyPath: "pourcentage")] #[Assert\Range( min: 0, max: 100, notInRangeMessage: 'Pourcentage doit étre entre {{ min }} et {{ max }}', )] private ?float $pourcentageMax = null; #[ORM\ManyToOne(inversedBy: 'mention')] private ?QuizResultat $quizResultat = null; #[ORM\OneToMany(mappedBy: 'mention', targetEntity: PourcentageQuiz::class)] private Collection $pourcentageQuizzes; public function __construct() { $this->pourcentageQuizzes = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getMention(): ?string { return $this->mention; } public function setMention(string $mention): self { $this->mention = $mention; return $this; } public function getPourcentage(): ?float { return $this->pourcentage; } public function setPourcentage(float $pourcentage): self { $this->pourcentage = $pourcentage; return $this; } public function getPourcentageMax(): ?float { return $this->pourcentageMax; } public function setPourcentageMax(float $pourcentageMax): self { $this->pourcentageMax = $pourcentageMax; return $this; } public function getQuizResultat(): ?QuizResultat { return $this->quizResultat; } public function setQuizResultat(?QuizResultat $quizResultat): self { $this->quizResultat = $quizResultat; return $this; } public function __toString() { return $this->mention ?? '' ; } /** * @return Collection<int, PourcentageQuiz> */ public function getPourcentageQuizzes(): Collection { return $this->pourcentageQuizzes; } public function addPourcentageQuiz(PourcentageQuiz $pourcentageQuiz): self { if (!$this->pourcentageQuizzes->contains($pourcentageQuiz)) { $this->pourcentageQuizzes->add($pourcentageQuiz); $pourcentageQuiz->setMention($this); } return $this; } public function removePourcentageQuiz(PourcentageQuiz $pourcentageQuiz): self { if ($this->pourcentageQuizzes->removeElement($pourcentageQuiz)) { // set the owning side to null (unless already changed) if ($pourcentageQuiz->getMention() === $this) { $pourcentageQuiz->setMention(null); } } return $this; }}