<?phpnamespace App\Entity;use App\Repository\RespondentRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Table(name="respondent") * @ORM\Entity(repositoryClass=RespondentRepository::class) */class Respondent{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="datetime_immutable") */ private $startTime; /** * @ORM\Column(type="datetime_immutable", nullable=true) */ private $endTime; /** * @ORM\Column(type="boolean") */ private $alreadyTrained; /** * @ORM\ManyToOne(targetEntity=Rank::class, inversedBy="respondents") * @ORM\JoinColumn(nullable=false) */ private $rank; /** * @ORM\OneToMany(targetEntity=Answer::class, mappedBy="respondent", orphanRemoval=true) */ private $answers; /** * @ORM\OneToMany(targetEntity=RespondentTraining::class, mappedBy="respondent") */ private $respondentTrainings; public function __construct() { $this->alreadyTrained = false; $this->answers = new ArrayCollection(); $this->respondentTrainings = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getStartTime(): ?\DateTimeImmutable { return $this->startTime; } public function setStartTime(\DateTimeImmutable $startTime): self { $this->startTime = $startTime; return $this; } public function getEndTime(): ?\DateTimeImmutable { return $this->endTime; } public function setEndTime(?\DateTimeImmutable $endTime): self { $this->endTime = $endTime; return $this; } public function isAlreadyTrained(): ?bool { return $this->alreadyTrained; } public function setAlreadyTrained(bool $alreadyTrained): self { $this->alreadyTrained = $alreadyTrained; return $this; } public function getRank(): ?Rank { return $this->rank; } public function setRank(?Rank $rank): self { $this->rank = $rank; return $this; } /** * @return Collection<int, Answer> */ public function getAnswers(): Collection { return $this->answers; } public function addAnswer(Answer $answer): self { if (!$this->answers->contains($answer)) { $this->answers[] = $answer; $answer->setRespondent($this); } return $this; } public function removeAnswer(Answer $answer): self { if ($this->answers->removeElement($answer)) { // set the owning side to null (unless already changed) if ($answer->getRespondent() === $this) { $answer->setRespondent(null); } } return $this; } /** * @return Collection<int, RespondentTraining> */ public function getRespondentTrainings(): Collection { return $this->respondentTrainings; } public function addRespondentTraining(RespondentTraining $respondentTraining): self { if (!$this->respondentTrainings->contains($respondentTraining)) { $this->respondentTrainings[] = $respondentTraining; $respondentTraining->setRespondent($this); } return $this; } public function removeRespondentTraining(RespondentTraining $respondentTraining): self { if ($this->respondentTrainings->removeElement($respondentTraining)) { // set the owning side to null (unless already changed) if ($respondentTraining->getRespondent() === $this) { $respondentTraining->setRespondent(null); } } return $this; }}