*/ #[ORM\ManyToMany(targetEntity: Answer::class, mappedBy: 'candidates')] private Collection $answersOnCandidate; /** @var Collection */ #[ORM\OneToMany(targetEntity: GivenAnswer::class, mappedBy: 'candidate', orphanRemoval: true)] private Collection $givenAnswers; /** @var Collection */ #[ORM\OneToMany(targetEntity: Correction::class, mappedBy: 'candidate', orphanRemoval: true)] private Collection $corrections; public function __construct( #[ORM\Column(length: 16)] private string $name, ) { $this->answersOnCandidate = new ArrayCollection(); $this->givenAnswers = new ArrayCollection(); $this->corrections = new ArrayCollection(); } public function getId(): ?Uuid { return $this->id; } public function getSeason(): Season { return $this->season; } public function setSeason(Season $season): static { $this->season = $season; return $this; } public function getName(): string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } /** @return Collection */ public function getAnswersOnCandidate(): Collection { return $this->answersOnCandidate; } public function addAnswersOnCandidate(Answer $answersOnCandidate): static { if (!$this->answersOnCandidate->contains($answersOnCandidate)) { $this->answersOnCandidate->add($answersOnCandidate); $answersOnCandidate->addCandidate($this); } return $this; } public function removeAnswersOnCandidate(Answer $answersOnCandidate): static { if ($this->answersOnCandidate->removeElement($answersOnCandidate)) { $answersOnCandidate->removeCandidate($this); } return $this; } /** @return Collection */ public function getGivenAnswers(): Collection { return $this->givenAnswers; } public function addGivenAnswer(GivenAnswer $givenAnswer): static { if (!$this->givenAnswers->contains($givenAnswer)) { $this->givenAnswers->add($givenAnswer); $givenAnswer->setCandidate($this); } return $this; } /** @return Collection */ public function getCorrections(): Collection { return $this->corrections; } public function addCorrection(Correction $correction): static { if (!$this->corrections->contains($correction)) { $this->corrections->add($correction); $correction->setCandidate($this); } return $this; } public function getNameHash(): string { return Base64::base64UrlEncode($this->name); } }