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