src/Entity/SatisfactionClientSurvey.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\TimestampableTrait;
  4. use App\Repository\SatisfactionClientSurveyRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassSatisfactionClientSurveyRepository::class)]
  9. class SatisfactionClientSurvey
  10. {
  11.     use TimestampableTrait;
  12.     #[ORM\IdORM\GeneratedValueORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private string $title;
  16.     #[ORM\ManyToMany(targetEntityCollaborator::class)]
  17.     private Collection $collaborators;
  18.     #[ORM\OneToMany(mappedBy'survey'targetEntitySatisfactionClientQuestion::class, cascade: ['persist''remove'])]
  19.     private Collection $questions;
  20.     #[ORM\OneToMany(mappedBy'survey'targetEntitySatisfactionClientSurveyResponse::class, cascade: ['remove'])]
  21.     private Collection $responses;
  22.     #[ORM\ManyToOne(targetEntityAccountingFirm::class, inversedBy'satisfactionClientSurveys')]
  23.     #[ORM\JoinColumn(nullablefalse)]
  24.     private AccountingFirm $accountingFirm;
  25.     #[ORM\OneToOne(targetEntityMailingTask::class, inversedBy'survey'cascade: ['persist''remove'])]
  26.     private ?MailingTask $mailingTask null;
  27.     #[ORM\Column(type:'boolean')]
  28.     private bool $sent;
  29.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy:'survey')]
  30.     #[ORM\JoinColumn(nullablefalse)]
  31.     private User $user;
  32.     #[ORM\ManyToOne(targetEntityEmailingClientCampaign::class)]
  33.     private $emailing;
  34.     private int $countMail 0;
  35.     public function __construct()
  36.     {
  37.         $this->collaborators = new ArrayCollection();
  38.         $this->questions = new ArrayCollection();
  39.         $this->responses = new ArrayCollection();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function setTitle(string $title): SatisfactionClientSurvey
  46.     {
  47.         $this->title $title;
  48.         return $this;
  49.     }
  50.     public function getTitle(): ?string
  51.     {
  52.         return $this->title;
  53.     }
  54.     public function setResponses(Collection $responses): SatisfactionClientSurvey
  55.     {
  56.         $this->responses $responses;
  57.         return $this;
  58.     }
  59.     public function addResponse(SatisfactionClientAnswer $response): SatisfactionClientSurvey{
  60.         $this->responses->add($response);
  61.         return $this;
  62.     }
  63.     public function getResponses(): Collection
  64.     {
  65.         return $this->responses;
  66.     }
  67.     
  68.     public function getAccountingFirm(): AccountingFirm
  69.     {
  70.         return $this->accountingFirm;
  71.     }
  72.     public function setAccountingFirmAccountingFirm $accountingFirm): SatisfactionClientSurvey
  73.     {
  74.         $this->accountingFirm $accountingFirm;
  75.         return $this;
  76.     }
  77.     public function getQuestions(): Collection
  78.     {
  79.         return $this->questions;
  80.     }
  81.     public function setQuestions(Collection $questions): SatisfactionClientSurvey{
  82.         $this->questions $questions;
  83.         return $this;
  84.     }
  85.     public function addQuestion(SatisfactionClientQuestion $question): SatisfactionClientSurvey {
  86.         if (!$this->questions->contains($question)) {
  87.             $this->questions->add($question);
  88.             $question->setSurvey($this);
  89.         }
  90.         return $this;
  91.     }
  92.     public function addCollaborator(Collaborator $collaborator): SatisfactionClientSurvey {
  93.         if (!$this->collaborators->contains($collaborator)) {
  94.             $this->collaborators->add($collaborator);
  95.             $collaborator->addSurvey($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeCollaborator(Collaborator $collaborator): SatisfactionClientSurvey {
  100.         if ($this->collaborators->contains($collaborator)) {
  101.             $this->collaborators->removeElement($collaborator);
  102.             $collaborator->removeSurvey($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function getCollaborators(): Collection {
  107.         return $this->collaborators;
  108.     }
  109.     public function setCollaborators(Collection $collaborators): SatisfactionClientSurvey {
  110.         $this->collaborators $collaborators;
  111.         return $this;
  112.     }
  113.     public function getClientMails(): Collection {
  114.         $clientMail = new ArrayCollection();
  115.         foreach($this->collaborators as $collaborator) {
  116.             $mailParCollab $collaborator->getClientEmails();
  117.             $clientMail->add($mailParCollab);
  118.         }
  119.         return $clientMail;
  120.     }
  121.     public function isSent(): bool {
  122.         return $this->sent;
  123.     }
  124.     public function setSent(bool $sent): SatisfactionClientSurvey {
  125.         $this->sent $sent;
  126.         return $this;
  127.     }
  128.     public function getCountMail(): int {
  129.         return $this->countMail;
  130.     }
  131.     public function setCountMail(int $countMail): SatisfactionClientSurvey {
  132.         $this->countMail $countMail;
  133.         return $this;
  134.     }
  135.     public function getMailingTask(): ?MailingTask {
  136.         return $this->mailingTask;
  137.     }
  138.     public function setMailingTask(?MailingTask $mailingTask): SatisfactionClientSurvey {
  139.         $this->mailingTask $mailingTask;
  140.         return $this;
  141.     }
  142.     public function getUser(){
  143.         return $this->user;
  144.     }
  145.     public function setUser(User $user): SatisfactionClientSurvey {
  146.         $this->user $user;
  147.         return $this;
  148.     }
  149.     public function getEmailing(): ?EmailingClientCampaign
  150.     {
  151.         return $this->emailing;
  152.     }
  153.     public function setEmailing(?EmailingClientCampaign $emailing): self
  154.     {
  155.         $this->emailing $emailing;
  156.         return $this;
  157.     }
  158. }