src/Entity/Respondent.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RespondentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="respondent")
  9.  * @ORM\Entity(repositoryClass=RespondentRepository::class)
  10.  */
  11. class Respondent
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="datetime_immutable")
  21.      */
  22.     private $startTime;
  23.     /**
  24.      * @ORM\Column(type="datetime_immutable", nullable=true)
  25.      */
  26.     private $endTime;
  27.     /**
  28.      * @ORM\Column(type="boolean")
  29.      */
  30.     private $alreadyTrained;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=Rank::class, inversedBy="respondents")
  33.      * @ORM\JoinColumn(nullable=false)
  34.      */
  35.     private $rank;
  36.     /**
  37.      * @ORM\OneToMany(targetEntity=Answer::class, mappedBy="respondent", orphanRemoval=true)
  38.      */
  39.     private $answers;
  40.     /**
  41.      * @ORM\OneToMany(targetEntity=RespondentTraining::class, mappedBy="respondent")
  42.      */
  43.     private $respondentTrainings;
  44.     public function __construct()
  45.     {
  46.         $this->alreadyTrained false;
  47.         $this->answers = new ArrayCollection();
  48.         $this->respondentTrainings = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getStartTime(): ?\DateTimeImmutable
  55.     {
  56.         return $this->startTime;
  57.     }
  58.     public function setStartTime(\DateTimeImmutable $startTime): self
  59.     {
  60.         $this->startTime $startTime;
  61.         return $this;
  62.     }
  63.     public function getEndTime(): ?\DateTimeImmutable
  64.     {
  65.         return $this->endTime;
  66.     }
  67.     public function setEndTime(?\DateTimeImmutable $endTime): self
  68.     {
  69.         $this->endTime $endTime;
  70.         return $this;
  71.     }
  72.     public function isAlreadyTrained(): ?bool
  73.     {
  74.         return $this->alreadyTrained;
  75.     }
  76.     public function setAlreadyTrained(bool $alreadyTrained): self
  77.     {
  78.         $this->alreadyTrained $alreadyTrained;
  79.         return $this;
  80.     }
  81.     public function getRank(): ?Rank
  82.     {
  83.         return $this->rank;
  84.     }
  85.     public function setRank(?Rank $rank): self
  86.     {
  87.         $this->rank $rank;
  88.         return $this;
  89.     }
  90.     /**
  91.      * @return Collection<int, Answer>
  92.      */
  93.     public function getAnswers(): Collection
  94.     {
  95.         return $this->answers;
  96.     }
  97.     public function addAnswer(Answer $answer): self
  98.     {
  99.         if (!$this->answers->contains($answer)) {
  100.             $this->answers[] = $answer;
  101.             $answer->setRespondent($this);
  102.         }
  103.         return $this;
  104.     }
  105.     public function removeAnswer(Answer $answer): self
  106.     {
  107.         if ($this->answers->removeElement($answer)) {
  108.             // set the owning side to null (unless already changed)
  109.             if ($answer->getRespondent() === $this) {
  110.                 $answer->setRespondent(null);
  111.             }
  112.         }
  113.         return $this;
  114.     }
  115.     /**
  116.      * @return Collection<int, RespondentTraining>
  117.      */
  118.     public function getRespondentTrainings(): Collection
  119.     {
  120.         return $this->respondentTrainings;
  121.     }
  122.     public function addRespondentTraining(RespondentTraining $respondentTraining): self
  123.     {
  124.         if (!$this->respondentTrainings->contains($respondentTraining)) {
  125.             $this->respondentTrainings[] = $respondentTraining;
  126.             $respondentTraining->setRespondent($this);
  127.         }
  128.         return $this;
  129.     }
  130.     public function removeRespondentTraining(RespondentTraining $respondentTraining): self
  131.     {
  132.         if ($this->respondentTrainings->removeElement($respondentTraining)) {
  133.             // set the owning side to null (unless already changed)
  134.             if ($respondentTraining->getRespondent() === $this) {
  135.                 $respondentTraining->setRespondent(null);
  136.             }
  137.         }
  138.         return $this;
  139.     }
  140. }