src/Entity/Survey.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\TimestampableTrait;
  4. use App\Repository\SurveyRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassSurveyRepository::class)]
  9. class Survey
  10. {
  11.     use TimestampableTrait;
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\ManyToOne(targetEntityAccountingFirm::class, inversedBy'surveys')]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private ?AccountingFirm $accountingFirm null;
  19.     #[ORM\Column(length255)]
  20.     private ?string $title null;
  21.     #[ORM\Column(type'boolean')]
  22.     private bool $isDraft true;
  23.     #[ORM\OneToMany(mappedBy'survey'targetEntityQuestion::class, orphanRemovaltruecascade: ['persist'])]
  24.     private Collection $questions;
  25.     #[ORM\OneToMany(mappedBy'survey'targetEntitySurveyResponse::class, orphanRemovaltrue)]
  26.     private Collection $responses;
  27.     #[ORM\ManyToOne(targetEntityEmailingClientCampaign::class)]
  28.     private $emailing;
  29.     public function __construct()
  30.     {
  31.         $this->questions = new ArrayCollection();
  32.         $this->responses = new ArrayCollection();
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getAccountingFirm(): ?AccountingFirm
  39.     {
  40.         return $this->accountingFirm;
  41.     }
  42.     public function setAccountingFirm(?AccountingFirm $accountingFirm): self
  43.     {
  44.         $this->accountingFirm $accountingFirm;
  45.         return $this;
  46.     }
  47.     public function getTitle(): ?string
  48.     {
  49.         return $this->title;
  50.     }
  51.     public function setTitle(string $title): self
  52.     {
  53.         $this->title $title;
  54.         return $this;
  55.     }
  56.     public function isDraft(): bool
  57.     {
  58.         return $this->isDraft;
  59.     }
  60.     public function setIsDraft(bool $isDraft): self
  61.     {
  62.         $this->isDraft $isDraft;
  63.         return $this;
  64.     }
  65.     /**
  66.      * @return Collection<int, Question>
  67.      */
  68.     public function getQuestions(): Collection
  69.     {
  70.         return $this->questions;
  71.     }
  72.     public function addQuestion(Question $question): self
  73.     {
  74.         if (!$this->questions->contains($question)) {
  75.             $this->questions->add($question);
  76.             $question->setSurvey($this);
  77.         }
  78.         return $this;
  79.     }
  80.     public function removeQuestion(Question $question): self
  81.     {
  82.         if ($this->questions->removeElement($question)) {
  83.             if ($question->getSurvey() === $this) {
  84.                 $question->setSurvey(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection<int, SurveyResponse>
  91.      */
  92.     public function getResponses(): Collection
  93.     {
  94.         return $this->responses;
  95.     }
  96.     public function addResponse(SurveyResponse $response): self
  97.     {
  98.         if (!$this->responses->contains($response)) {
  99.             $this->responses->add($response);
  100.             $response->setSurvey($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removeResponse(SurveyResponse $response): self
  105.     {
  106.         if ($this->responses->removeElement($response)) {
  107.             if ($response->getSurvey() === $this) {
  108.                 $response->setSurvey(null);
  109.             }
  110.         }
  111.         return $this;
  112.     }
  113.     public function getEmailing(): ?EmailingClientCampaign
  114.     {
  115.         return $this->emailing;
  116.     }
  117.     public function setEmailing(?EmailingClientCampaign $emailing): self
  118.     {
  119.         $this->emailing $emailing;
  120.         return $this;
  121.     }
  122. }