src/Entity/Newsletter.php line 14

Open in your IDE?
  1. <?php
  2.     namespace App\Entity;
  3.     use App\Repository\NewsletterRepository;
  4.     use App\Traits\DateTrait;
  5.     use DateTimeInterface;
  6.     use Doctrine\ORM\Mapping as ORM;
  7.     /**
  8.      * @ORM\Entity(repositoryClass=NewsletterRepository::class)
  9.      * @ORM\HasLifecycleCallbacks()
  10.      */
  11.     class Newsletter
  12.     {
  13.         use DateTrait;
  14.         public const STATUS_DRAFT      "draft";
  15.         public const STATUS_PENDING    "pending";
  16.         public const STATUS_PROGRAMMED "programmed";
  17.         public const STATUS_PROCESSING "processing";
  18.         public const STATUS_STOPPED    "stopped";
  19.         public const STATUS_SENT       "sent";
  20.         public const CONTENT_TAGS = [
  21.             // pour gĂ©rer [AVAILABLE_POINTS]
  22.             'recipient',
  23.             'contact_first_name',
  24.             'contact_last_name',
  25.             'contact_full_name',
  26.             'contact_email',
  27.             'contact_phone',
  28.             'contact_address',
  29.             'current_date',
  30.             'current_day',
  31.             'current_month',
  32.             'current_year'
  33.         ];
  34.         /**
  35.          * @ORM\Id
  36.          * @ORM\GeneratedValue
  37.          * @ORM\Column(type="integer")
  38.          */
  39.         private ?int $id NULL;
  40.         /**
  41.          * @ORM\Column(type="string", length=255)
  42.          */
  43.         private ?string $name NULL;
  44.         /**
  45.          * @ORM\Column(type="text", nullable=true)
  46.          */
  47.         private ?string $description NULL;
  48.         /**
  49.          * @ORM\Column(type="string", length=255)
  50.          */
  51.         private ?string $subject NULL;
  52.         /**
  53.          * @ORM\Column(type="text", nullable=true)
  54.          */
  55.         private ?string $contents NULL;
  56.         /**
  57.          * @ORM\Column(type="datetime", nullable=true)
  58.          */
  59.         private ?DateTimeInterface $requestDateTimeSend NULL;
  60.         /**
  61.          * @ORM\Column(type="datetime", nullable=true)
  62.          */
  63.         private ?DateTimeInterface $sendAt NULL;
  64.         /**
  65.          * @ORM\Column(type="boolean", options={"default":false})
  66.          */
  67.         private bool $sendNow FALSE;
  68.         /**
  69.          * @ORM\Column(type="string", length=50, options={"default":self::STATUS_PENDING})
  70.          */
  71.         private string $status self::STATUS_PENDING;
  72.         /**
  73.          * @ORM\ManyToOne(targetEntity=ContactList::class, inversedBy="newsletters")
  74.          * @ORM\JoinColumn(nullable=false)
  75.          */
  76.         private ?ContactList $contactList;
  77.         /**
  78.          * @ORM\Column(type="string", length=255)
  79.          */
  80.         private ?string $templateType NULL;
  81.         /**
  82.          * @ORM\Column(type="string", length=64)
  83.          */
  84.         private ?string $templateId NULL;
  85.         /**
  86.          * @ORM\Column(type="string", length=255, nullable=true)
  87.          */
  88.         private ?string $mailwizzId NULL;
  89.         /**
  90.          * @ORM\Column(type="boolean", options={"default":false})
  91.          */
  92.         private bool $isSendToMailwizz FALSE;
  93.         /**
  94.          * @ORM\Column(type="simple_array", nullable=true)
  95.          */
  96.         private ?array $emails;
  97.         /**
  98.          * @ORM\Column(type="text")
  99.          */
  100.         private ?string $htmlPath NULL;
  101.         /**
  102.          * ******************************************************
  103.          * ********************* START CUSTOM *******************
  104.          * ******************************************************
  105.          */
  106.         public function isEditable(): bool
  107.         {
  108.             return $this->status === self::STATUS_DRAFT || $this->status === self::STATUS_PENDING;
  109.         }
  110.         public function isProcessing(): bool
  111.         {
  112.             return $this->status === self::STATUS_PROCESSING;
  113.         }
  114.         public function isStopped(): bool
  115.         {
  116.             return $this->status === self::STATUS_STOPPED;
  117.         }
  118.         /**
  119.          * ******************************************************
  120.          * ********************** END CUSTOM ********************
  121.          * ******************************************************
  122.          */
  123.         public function getId(): ?int
  124.         {
  125.             return $this->id;
  126.         }
  127.         public function getName(): ?string
  128.         {
  129.             return $this->name;
  130.         }
  131.         public function setName(string $name): self
  132.         {
  133.             $this->name $name;
  134.             return $this;
  135.         }
  136.         public function getSubject(): ?string
  137.         {
  138.             return $this->subject;
  139.         }
  140.         public function setSubject(string $subject): self
  141.         {
  142.             $this->subject $subject;
  143.             return $this;
  144.         }
  145.         public function getDescription()
  146.         {
  147.             return $this->description;
  148.         }
  149.         public function setDescription($description): self
  150.         {
  151.             $this->description $description;
  152.             return $this;
  153.         }
  154.         public function getContents(): ?string
  155.         {
  156.             return $this->contents;
  157.         }
  158.         public function setContents(?string $contents): self
  159.         {
  160.             $this->contents $contents;
  161.             return $this;
  162.         }
  163.         public function getRequestDateTimeSend(): ?DateTimeInterface
  164.         {
  165.             return $this->requestDateTimeSend;
  166.         }
  167.         public function setRequestDateTimeSend(?DateTimeInterface $requestDateTimeSend): self
  168.         {
  169.             $this->requestDateTimeSend $requestDateTimeSend;
  170.             return $this;
  171.         }
  172.         public function getSendAt(): ?DateTimeInterface
  173.         {
  174.             return $this->sendAt;
  175.         }
  176.         public function setSendAt(?DateTimeInterface $sendAt): self
  177.         {
  178.             $this->sendAt $sendAt;
  179.             return $this;
  180.         }
  181.         public function getSendNow(): ?bool
  182.         {
  183.             return $this->sendNow;
  184.         }
  185.         public function setSendNow(bool $sendNow): self
  186.         {
  187.             $this->sendNow $sendNow;
  188.             return $this;
  189.         }
  190.         public function getStatus(): ?string
  191.         {
  192.             return $this->status;
  193.         }
  194.         public function setStatus(string $status): self
  195.         {
  196.             $this->status $status;
  197.             return $this;
  198.         }
  199.         public function getContactList(): ?ContactList
  200.         {
  201.             return $this->contactList;
  202.         }
  203.         public function setContactList(?ContactList $contactList): self
  204.         {
  205.             $this->contactList $contactList;
  206.             return $this;
  207.         }
  208.         public function getTemplateType(): ?string
  209.         {
  210.             return $this->templateType;
  211.         }
  212.         public function setTemplateType(string $templateType): self
  213.         {
  214.             $this->templateType $templateType;
  215.             return $this;
  216.         }
  217.         public function getMailwizzId(): ?string
  218.         {
  219.             return $this->mailwizzId;
  220.         }
  221.         public function setMailwizzId(?string $mailwizzId): self
  222.         {
  223.             $this->mailwizzId $mailwizzId;
  224.             return $this;
  225.         }
  226.         public function isIsSendToMailwizz(): ?bool
  227.         {
  228.             return $this->isSendToMailwizz;
  229.         }
  230.         public function setIsSendToMailwizz(bool $isSendToMailwizz): self
  231.         {
  232.             $this->isSendToMailwizz $isSendToMailwizz;
  233.             return $this;
  234.         }
  235.         public function getEmails(): ?array
  236.         {
  237.             return $this->emails;
  238.         }
  239.         public function setEmails(?array $emails): self
  240.         {
  241.             $this->emails $emails;
  242.             return $this;
  243.         }
  244.         public function getHtmlPath(): ?string
  245.         {
  246.             return $this->htmlPath;
  247.         }
  248.         public function setHtmlPath(string $htmlPath): self
  249.         {
  250.             $this->htmlPath $htmlPath;
  251.             return $this;
  252.         }
  253.         public function getTemplateId(): ?string
  254.         {
  255.             return $this->templateId;
  256.         }
  257.         public function setTemplateId(string $templateId): self
  258.         {
  259.             $this->templateId $templateId;
  260.             return $this;
  261.         }
  262.     }