src/Entity/CRM/Survey.php line 11
<?php// src/Entity/Survey.phpnamespace App\Entity\CRM;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{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type: 'integer')]private ?int $id = null;#[ORM\Column(type: 'string', length: 150)]private ?string $title = null;#[ORM\Column(type: 'text', nullable: true)]private ?string $description = null;#[ORM\OneToMany(mappedBy: 'survey', targetEntity: SurveyQuestion::class, cascade: ['persist', 'remove'])]private Collection $questions;#[ORM\OneToMany(mappedBy: 'survey', targetEntity: SurveyResponse::class, cascade: ['persist', 'remove'])]private Collection $responses;#[ORM\Column]private ?bool $isActive = null;public function __construct(){$this->questions = new ArrayCollection();$this->responses = new ArrayCollection();}public function __toString(): string{return $this->title;}public function getId(): ?int{return $this->id;}public function getTitle(): ?string{return $this->title;}public function setTitle(string $title): self{$this->title = $title;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}/*** @return Collection|SurveyQuestion[]*/public function getQuestions(): Collection{return $this->questions;}public function addQuestion(SurveyQuestion $question): self{if (!$this->questions->contains($question)) {$this->questions[] = $question;$question->setSurvey($this);}return $this;}public function removeQuestion(SurveyQuestion $question): self{if ($this->questions->removeElement($question)) {// ustawienie relacji na null, jeśli to konieczneif ($question->getSurvey() === $this) {$question->setSurvey(null);}}return $this;}/*** @return Collection|SurveyResponse[]*/public function getResponses(): Collection{return $this->responses;}public function addResponse(SurveyResponse $response): self{if (!$this->responses->contains($response)) {$this->responses[] = $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 isIsActive(): ?bool{return $this->isActive;}public function setIsActive(bool $isActive): static{$this->isActive = $isActive;return $this;}}