<?phpnamespace App\Entity;use App\Entity\Traits\TimestampableTrait;use App\Repository\SurveyRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: SurveyRepository::class)]class Survey{ use TimestampableTrait; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\ManyToOne(targetEntity: AccountingFirm::class, inversedBy: 'surveys')] #[ORM\JoinColumn(nullable: false)] private ?AccountingFirm $accountingFirm = null; #[ORM\Column(length: 255)] private ?string $title = null; #[ORM\Column(type: 'boolean')] private bool $isDraft = true; #[ORM\OneToMany(mappedBy: 'survey', targetEntity: Question::class, orphanRemoval: true, cascade: ['persist'])] private Collection $questions; #[ORM\OneToMany(mappedBy: 'survey', targetEntity: SurveyResponse::class, orphanRemoval: true)] private Collection $responses; #[ORM\ManyToOne(targetEntity: EmailingClientCampaign::class)] private $emailing; public function __construct() { $this->questions = new ArrayCollection(); $this->responses = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getAccountingFirm(): ?AccountingFirm { return $this->accountingFirm; } public function setAccountingFirm(?AccountingFirm $accountingFirm): self { $this->accountingFirm = $accountingFirm; return $this; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function isDraft(): bool { return $this->isDraft; } public function setIsDraft(bool $isDraft): self { $this->isDraft = $isDraft; return $this; } /** * @return Collection<int, Question> */ public function getQuestions(): Collection { return $this->questions; } public function addQuestion(Question $question): self { if (!$this->questions->contains($question)) { $this->questions->add($question); $question->setSurvey($this); } return $this; } public function removeQuestion(Question $question): self { if ($this->questions->removeElement($question)) { if ($question->getSurvey() === $this) { $question->setSurvey(null); } } return $this; } /** * @return Collection<int, SurveyResponse> */ public function getResponses(): Collection { return $this->responses; } public function addResponse(SurveyResponse $response): self { if (!$this->responses->contains($response)) { $this->responses->add($response); $response->setSurvey($this); } return $this; } public function removeResponse(SurveyResponse $response): self { if ($this->responses->removeElement($response)) { if ($response->getSurvey() === $this) { $response->setSurvey(null); } } return $this; } public function getEmailing(): ?EmailingClientCampaign { return $this->emailing; } public function setEmailing(?EmailingClientCampaign $emailing): self { $this->emailing = $emailing; return $this; }}