src/Entity/EmailingClientCampaign.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EmailingClientCampaignRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassEmailingClientCampaignRepository::class)]
  8. class EmailingClientCampaign
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255)]
  15.     private $name;
  16.     #[ORM\ManyToMany(targetEntityEmailingClientList::class, inversedBy'campaigns')]
  17.     private $diffusionLists;
  18.     #[ORM\Column(type'string'length255nullabletrue)]
  19.     private $object;
  20.     #[ORM\Column(type'json'nullabletrue)]
  21.     private $mjmlStructure = [];
  22.     #[ORM\Column(type'datetime'nullabletrue)]
  23.     private $sendDate;
  24.     #[ORM\Column(type'string'length255)]
  25.     private $status;
  26.     #[ORM\ManyToOne(targetEntityAccountingFirm::class, inversedBy'emailingClientCampaigns')]
  27.     private $accountingFirm;
  28.     #[ORM\OneToMany(mappedBy'emailingClientCampaign'targetEntityMailingTask::class)]
  29.     private $mailingTask;
  30.     #[ORM\Column(type'integer'nullabletrue)]
  31.     private $tokenUsed;
  32.     #[ORM\ManyToOne(targetEntitySatisfactionClientSurvey::class, inversedBy'surveys')]
  33.     private $satisfactionClientSurvey;
  34.     #[ORM\ManyToOne(targetEntitySurvey::class)]
  35.     #[ORM\JoinColumn(onDelete'SET NULL')]
  36.     private $survey;
  37.     #[ORM\Column(type'json'nullabletrue)]
  38.     private ?array $collaboratorsData null;
  39.     #[ORM\Column(type'float'nullabletrue)]
  40.     private $openRate;
  41.     #[ORM\Column(type'float'nullabletrue)]
  42.     private $clickRate;
  43.     #[ORM\Column(type'float'nullabletrue)]
  44.     private $unsubscribeRate;
  45.     #[ORM\Column(type'float'nullabletrue)]
  46.     private $bounceRate;
  47.     #[ORM\Column(type'string'length255nullabletrue)]
  48.     private $mailjetId;
  49.     #[ORM\Column(type'integer'nullabletrue)]
  50.     private $deliveredCount;
  51.     #[ORM\Column(type'datetime_immutable'nullabletrue)]
  52.     private ?\DateTimeImmutable $statsUpdatedAt null;
  53.     #[ORM\Column(type'json'nullabletrue)]
  54.     private $selectedEmails = [];
  55.     #[ORM\Column(type'json'nullabletrue)]
  56.     private $selectedCategories = [];
  57.     #[ORM\Column(type'json'nullabletrue)]
  58.     private $selectedTags = [];
  59.     #[ORM\Column(type'json'nullabletrue)]
  60.     private $widget = [];
  61.     public function __construct()
  62.     {
  63.         $this->mailingTask = new ArrayCollection();
  64.         $this->diffusionLists = new ArrayCollection();
  65.     }
  66.     public function getId(): ?int
  67.     {
  68.         return $this->id;
  69.     }
  70.      public function getCollaboratorsData(): ?array
  71.     {
  72.         return $this->collaboratorsData;
  73.     }
  74.     public function setCollaboratorsData(?array $collaboratorsData): self
  75.     {
  76.         $this->collaboratorsData $collaboratorsData;
  77.         return $this;
  78.     }
  79.     public function getName(): ?string
  80.     {
  81.         return $this->name;
  82.     }
  83.     public function setName(string $name): self
  84.     {
  85.         $this->name $name;
  86.         return $this;
  87.     }
  88.     /**
  89.      * @return Collection<int, EmailingClientList>
  90.      */
  91.     public function getDiffusionLists(): Collection
  92.     {
  93.         return $this->diffusionLists;
  94.     }
  95.     public function addDiffusionList(EmailingClientList $diffusionList): self
  96.     {
  97.         if (!$this->diffusionLists->contains($diffusionList)) {
  98.             $this->diffusionLists[] = $diffusionList;
  99.         }
  100.         return $this;
  101.     }
  102.     public function removeDiffusionList(EmailingClientList $diffusionList): self
  103.     {
  104.         $this->diffusionLists->removeElement($diffusionList);
  105.         return $this;
  106.     }
  107.     public function clearDiffusionLists(): self
  108.     {
  109.         $this->diffusionLists->clear();
  110.         return $this;
  111.     }
  112.     public function getObject(): ?string
  113.     {
  114.         return $this->object;
  115.     }
  116.     public function setObject(?string $object): self
  117.     {
  118.         $this->object $object;
  119.         return $this;
  120.     }
  121.     public function getMjmlStructure(): ?array
  122.     {
  123.         return $this->mjmlStructure;
  124.     }
  125.     public function setMjmlStructure(?array $mjmlStructure): self
  126.     {
  127.         $this->mjmlStructure $mjmlStructure;
  128.         return $this;
  129.     }
  130.     public function getSendDate(): ?\DateTime
  131.     {
  132.         return $this->sendDate;
  133.     }
  134.     public function setSendDate(?\DateTime $sendDate): self
  135.     {
  136.         $this->sendDate $sendDate;
  137.         return $this;
  138.     }
  139.     public function getStatus(): ?string
  140.     {
  141.         return $this->status;
  142.     }
  143.     public function setStatus(string $status): self
  144.     {
  145.         $this->status $status;
  146.         return $this;
  147.     }
  148.     public function getAccountingFirm(): ?AccountingFirm
  149.     {
  150.         return $this->accountingFirm;
  151.     }
  152.     public function setAccountingFirm(?AccountingFirm $accountingFirm): self
  153.     {
  154.         $this->accountingFirm $accountingFirm;
  155.         return $this;
  156.     }
  157.     /**
  158.      * @return Collection<int, MailingTask>
  159.      */
  160.     public function getMailingTask(): Collection
  161.     {
  162.         return $this->mailingTask;
  163.     }
  164.     public function addMailingTask(MailingTask $mailingTask): self
  165.     {
  166.         if (!$this->mailingTask->contains($mailingTask)) {
  167.             $this->mailingTask[] = $mailingTask;
  168.             $mailingTask->setEmailingClientCampaign($this);
  169.         }
  170.         return $this;
  171.     }
  172.     public function removeMailingTask(MailingTask $mailingTask): self
  173.     {
  174.         if ($this->mailingTask->removeElement($mailingTask)) {
  175.             // set the owning side to null (unless already changed)
  176.             if ($mailingTask->getEmailingClientCampaign() === $this) {
  177.                 $mailingTask->setEmailingClientCampaign(null);
  178.             }
  179.         }
  180.         return $this;
  181.     }
  182.     public function getTokenUsed(): ?int
  183.     {
  184.         return $this->tokenUsed;
  185.     }
  186.     public function setTokenUsed(?int $tokenUsed): self
  187.     {
  188.         $this->tokenUsed $tokenUsed;
  189.         return $this;
  190.     }
  191.     public function getSurvey(): ?Survey
  192.     {
  193.         return $this->survey;
  194.     }
  195.     public function setSurvey(?Survey $survey): self
  196.     {
  197.         $this->survey $survey;
  198.         return $this;
  199.     }
  200.     public function getSatisfactionClientSurvey(): ?SatisfactionClientSurvey
  201.     {
  202.         return $this->satisfactionClientSurvey;
  203.     }
  204.     public function setSatisfactionClientSurvey(SatisfactionClientSurvey $satisfactionClientSurvey): self
  205.     {
  206.         $this->satisfactionClientSurvey $satisfactionClientSurvey;
  207.         return $this;
  208.     }
  209.     public function getOpenRate(): ?float
  210.     {
  211.         return $this->openRate;
  212.     }
  213.     public function setOpenRate(?float $openRate): self
  214.     {
  215.         $this->openRate $openRate;
  216.         return $this;
  217.     }
  218.     public function getClickRate(): ?float
  219.     {
  220.         return $this->clickRate;
  221.     }
  222.     public function setClickRate(?float $clickRate): self
  223.     {
  224.         $this->clickRate $clickRate;
  225.         return $this;
  226.     }
  227.     public function getUnsubscribeRate(): ?float
  228.     {
  229.         return $this->unsubscribeRate;
  230.     }
  231.     public function setUnsubscribeRate(?float $unsubscribeRate): self
  232.     {
  233.         $this->unsubscribeRate $unsubscribeRate;
  234.         return $this;
  235.     }
  236.     public function getBounceRate(): ?float
  237.     {
  238.         return $this->bounceRate;
  239.     }
  240.     public function setBounceRate(?float $bounceRate): self
  241.     {
  242.         $this->bounceRate $bounceRate;
  243.         return $this;
  244.     }
  245.     public function getMailjetId(): ?string
  246.     {
  247.         return $this->mailjetId;
  248.     }
  249.     public function setMailjetId(?string $mailjetId): self
  250.     {
  251.         $this->mailjetId $mailjetId;
  252.         return $this;
  253.     }
  254.     public function getDeliveredCount(): ?int
  255.     {
  256.         return $this->deliveredCount;
  257.     }
  258.     public function setDeliveredCount(?int $deliveredCount): self
  259.     {
  260.         $this->deliveredCount $deliveredCount;
  261.         return $this;
  262.     }
  263.     public function getStatsUpdatedAt(): ?\DateTimeImmutable
  264.     {
  265.         return $this->statsUpdatedAt;
  266.     }
  267.     public function setStatsUpdatedAt(?\DateTimeImmutable $statsUpdatedAt): self
  268.     {
  269.         $this->statsUpdatedAt $statsUpdatedAt;
  270.         return $this;
  271.     }
  272.     public function getSelectedCategories(): ?array
  273.     {
  274.         return $this->selectedCategories;
  275.     }
  276.     public function setSelectedCategories(ArrayCollection|array $selectedCategories): self
  277.     {
  278.         if ($selectedCategories instanceof Collection) {
  279.             $this->selectedCategories $selectedCategories->map(fn($cat) => $cat->getId())->toArray();
  280.         } elseif (is_array($selectedCategories)) {
  281.             $this->selectedCategories $selectedCategories;
  282.         } else {
  283.             $this->selectedCategories = [];
  284.         }
  285.         return $this;
  286.     }
  287.     public function getSelectedTags(): ?array
  288.     {
  289.         return $this->selectedTags;
  290.     }
  291.     public function setSelectedTags(ArrayCollection|array $selectedTags): self
  292.     {
  293.         if ($selectedTags instanceof Collection) {
  294.             $this->selectedTags $selectedTags->map(fn($tag) => $tag->getId())->toArray();
  295.         } elseif (is_array($selectedTags)) {
  296.             $this->selectedTags $selectedTags;
  297.         } else {
  298.             $this->selectedTags = [];
  299.         }
  300.         return $this;
  301.     }
  302.     public function getWidget(): ?array
  303.     {
  304.         return $this->widget;
  305.     }
  306.     public function getSelectedEmails(): ?array
  307.     {
  308.         return $this->selectedEmails;
  309.     }
  310.     public function setSelectedEmails(?array $selectedEmails): self
  311.     {
  312.         $this->selectedEmails $selectedEmails;
  313.         return $this;
  314.     }
  315.     public function setWidget(?array $widget): self
  316.     {
  317.         $this->widget $widget;
  318.         return $this;
  319.     }
  320.     public function hasWidget(): bool
  321.     {
  322.         return $this->widget !== null && !empty($this->widget);
  323.     }
  324.     public function getWidgetType(): ?string
  325.     {
  326.         return $this->widget['type'] ?? null;
  327.     }
  328.     public function getWidgetId(): ?int
  329.     {
  330.         return $this->widget['id'] ?? null;
  331.     }
  332.     public function setWidgetData(string $typeint $id): self
  333.     {
  334.         $this->widget = [
  335.             'type' => $type,
  336.             'id' => $id
  337.         ];
  338.         return $this;
  339.     }
  340. }