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