src/Entity/Evaluation.php line 12
<?php
namespace App\Entity;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\EvaluationRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
#[ORM\Entity(repositoryClass: EvaluationRepository::class)]
class Evaluation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private ?\DateTimeImmutable $createdAt = null;
#[ORM\ManyToOne(inversedBy: 'evaluations')]
#[ORM\JoinColumn(nullable: false)]
private ?Company $company = null;
#[ORM\OneToMany(mappedBy: 'evaluation', targetEntity: EvaluationAnswer::class, orphanRemoval: true, fetch: "EAGER")]
private Collection $evaluationAnswers;
private array $answersBySubThematic;
#[ORM\ManyToOne(inversedBy: 'evaluations')]
#[ORM\JoinColumn(nullable: false)]
private ?Questionnaire $questionnaire = null;
#[ORM\ManyToOne(inversedBy: 'evaluations')]
#[ORM\JoinColumn(nullable: true)]
private ?User $author = null;
#[ORM\OneToMany(mappedBy: 'evaluation', targetEntity: EditEvaluationHistory::class, orphanRemoval: true, fetch: "EAGER")]
private Collection $editEvaluationHistories;
public function __construct()
{
$this->evaluationAnswers = new ArrayCollection();
$this->createdAt = new DateTimeImmutable();
$this->editEvaluationHistories = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): self
{
$this->company = $company;
return $this;
}
/**
* @return Collection<int, EvaluationAnswer>
*/
public function getEvaluationAnswers(): Collection
{
return $this->evaluationAnswers;
}
public function addEvaluationAnswer(EvaluationAnswer $evaluationAnswer): self
{
if (!$this->evaluationAnswers->contains($evaluationAnswer)) {
$this->evaluationAnswers->add($evaluationAnswer);
$evaluationAnswer->setEvaluation($this);
}
return $this;
}
public function removeEvaluationAnswer(EvaluationAnswer $evaluationAnswer): self
{
if ($this->evaluationAnswers->removeElement($evaluationAnswer)) {
// set the owning side to null (unless already changed)
if ($evaluationAnswer->getEvaluation() === $this) {
$evaluationAnswer->setEvaluation(null);
}
}
return $this;
}
public function getAnswersBySubThematic(): ?array
{
return $this->answersBySubThematic;
}
public function setAnswersBySubThematic(array $answersBySubThematic): self
{
$this->answersBySubThematic = $answersBySubThematic;
return $this;
}
public function getQuestionnaire(): ?Questionnaire
{
return $this->questionnaire;
}
public function setQuestionnaire(?Questionnaire $questionnaire): self
{
$this->questionnaire = $questionnaire;
return $this;
}
public function getAuthor(): ?User
{
return $this->author;
}
public function setAuthor(?User $author): self
{
$this->author = $author;
return $this;
}
/**
* @return Collection<int, EditEvaluationHistory>
*/
public function getEditEvaluationHistories(): Collection
{
return $this->editEvaluationHistories;
}
public function addEditEvaluationHistory(EditEvaluationHistory $editEvaluationHistory): self
{
if (!$this->editEvaluationHistories->contains($editEvaluationHistory)) {
$this->editEvaluationHistories->add($editEvaluationHistory);
$editEvaluationHistory->setEvaluation($this);
}
return $this;
}
public function removeEditEvaluationHistory(EditEvaluationHistory $editEvaluationHistory): self
{
if ($this->editEvaluationHistories->removeElement($editEvaluationHistory)) {
// set the owning side to null (unless already changed)
if ($editEvaluationHistory->getEvaluation() === $this) {
$editEvaluationHistory->setEvaluation(null);
}
}
return $this;
}
}