<?php
namespace App\Entity;
use App\Repository\SatisfactionClientSurveyResponseRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SatisfactionClientSurveyResponseRepository::class)]
class SatisfactionClientSurveyResponse
{
#[ORM\Id, ORM\GeneratedValue, ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: SatisfactionClientSurvey::class, inversedBy: 'responses')]
private SatisfactionClientSurvey $survey;
#[ORM\Column(type: 'datetime')]
private \DateTimeInterface $answeredAt;
#[ORM\OneToMany(mappedBy: 'surveyResponse', targetEntity: SatisfactionClientAnswer::class, cascade: ['persist', 'remove'])]
private Collection $answers;
public function __construct()
{
$this->answeredAt = new \DateTime();
$this->answers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setAnswers( Collection $answers): SatisfactionClientSurveyResponse{
$this->answers = $answers;
return $this;
}
public function getAnswers(): Collection
{
return $this->answers;
}
public function addAnswer( SatisfactionClientAnswer $answer): SatisfactionClientSurveyResponse{
$this->answers->add($answer);
return $this;
}
public function setSurvey( SatisfactionClientSurvey $survey): SatisfactionClientSurveyResponse{
$this->survey = $survey;
return $this;
}
public function getSurvey(): SatisfactionClientSurvey{
return $this->survey;
}
public function getAnsweredAt(): \DateTime{
return $this->answeredAt;
}
public function setAnsweredAt(\DateTime $answeredAt): SatisfactionClientSurveyResponse{
$this->answeredAt = $answeredAt;
return $this;
}
}