src/Entity/Evaluation.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use DateTimeImmutable;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Repository\EvaluationRepository;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. #[ORM\Entity(repositoryClassEvaluationRepository::class)]
  9. class Evaluation
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column]
  16.     private ?\DateTimeImmutable $createdAt null;
  17.     #[ORM\ManyToOne(inversedBy'evaluations')]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?Company $company null;
  20.     #[ORM\OneToMany(mappedBy'evaluation'targetEntityEvaluationAnswer::class, orphanRemovaltruefetch"EAGER")]
  21.     private Collection $evaluationAnswers;
  22.     private array $answersBySubThematic;
  23.     #[ORM\ManyToOne(inversedBy'evaluations')]
  24.     #[ORM\JoinColumn(nullablefalse)]
  25.     private ?Questionnaire $questionnaire null;
  26.     #[ORM\ManyToOne(inversedBy'evaluations')]
  27.     #[ORM\JoinColumn(nullabletrue)]
  28.     private ?User $author null;
  29.     #[ORM\OneToMany(mappedBy'evaluation'targetEntityEditEvaluationHistory::class, orphanRemovaltruefetch"EAGER")]
  30.     private Collection $editEvaluationHistories;
  31.     public function __construct()
  32.     {
  33.         $this->evaluationAnswers = new ArrayCollection();
  34.         $this->createdAt = new DateTimeImmutable();
  35.         $this->editEvaluationHistories = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getCreatedAt(): ?\DateTimeImmutable
  42.     {
  43.         return $this->createdAt;
  44.     }
  45.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  46.     {
  47.         $this->createdAt $createdAt;
  48.         return $this;
  49.     }
  50.     public function getCompany(): ?Company
  51.     {
  52.         return $this->company;
  53.     }
  54.     public function setCompany(?Company $company): self
  55.     {
  56.         $this->company $company;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return Collection<int, EvaluationAnswer>
  61.      */
  62.     public function getEvaluationAnswers(): Collection
  63.     {
  64.         return $this->evaluationAnswers;
  65.     }
  66.     public function addEvaluationAnswer(EvaluationAnswer $evaluationAnswer): self
  67.     {
  68.         if (!$this->evaluationAnswers->contains($evaluationAnswer)) {
  69.             $this->evaluationAnswers->add($evaluationAnswer);
  70.             $evaluationAnswer->setEvaluation($this);
  71.         }
  72.         return $this;
  73.     }
  74.     public function removeEvaluationAnswer(EvaluationAnswer $evaluationAnswer): self
  75.     {
  76.         if ($this->evaluationAnswers->removeElement($evaluationAnswer)) {
  77.             // set the owning side to null (unless already changed)
  78.             if ($evaluationAnswer->getEvaluation() === $this) {
  79.                 $evaluationAnswer->setEvaluation(null);
  80.             }
  81.         }
  82.         return $this;
  83.     }
  84.     public function getAnswersBySubThematic(): ?array
  85.     {
  86.         return $this->answersBySubThematic;
  87.     }
  88.     public function setAnswersBySubThematic(array $answersBySubThematic): self
  89.     {
  90.         $this->answersBySubThematic $answersBySubThematic;
  91.         return $this;
  92.     }
  93.     public function getQuestionnaire(): ?Questionnaire
  94.     {
  95.         return $this->questionnaire;
  96.     }
  97.     public function setQuestionnaire(?Questionnaire $questionnaire): self
  98.     {
  99.         $this->questionnaire $questionnaire;
  100.         return $this;
  101.     }
  102.     public function getAuthor(): ?User
  103.     {
  104.         return $this->author;
  105.     }
  106.     public function setAuthor(?User $author): self
  107.     {
  108.         $this->author $author;
  109.         return $this;
  110.     }
  111.     /**
  112.      * @return Collection<int, EditEvaluationHistory>
  113.      */
  114.     public function getEditEvaluationHistories(): Collection
  115.     {
  116.         return $this->editEvaluationHistories;
  117.     }
  118.     public function addEditEvaluationHistory(EditEvaluationHistory $editEvaluationHistory): self
  119.     {
  120.         if (!$this->editEvaluationHistories->contains($editEvaluationHistory)) {
  121.             $this->editEvaluationHistories->add($editEvaluationHistory);
  122.             $editEvaluationHistory->setEvaluation($this);
  123.         }
  124.         return $this;
  125.     }
  126.     public function removeEditEvaluationHistory(EditEvaluationHistory $editEvaluationHistory): self
  127.     {
  128.         if ($this->editEvaluationHistories->removeElement($editEvaluationHistory)) {
  129.             // set the owning side to null (unless already changed)
  130.             if ($editEvaluationHistory->getEvaluation() === $this) {
  131.                 $editEvaluationHistory->setEvaluation(null);
  132.             }
  133.         }
  134.         return $this;
  135.     }
  136. }