src/Entity/CRM/MailTemplate.php line 13

  1. <?php
  2. namespace App\Entity\CRM;
  3. use App\Repository\MailTemplateRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. #[ORM\Entity(repositoryClassMailTemplateRepository::class)]
  10. class MailTemplate
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $name null;
  18.     #[ORM\Column(typeTypes::TEXT)]
  19.     private ?string $html null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $subject null;
  22.     #[ORM\Column(typeTypes::SIMPLE_ARRAYnullabletrue)]
  23.     private array $attachment = [];
  24.     #[ORM\Column(typeTypes::SIMPLE_ARRAYnullabletrue)]
  25.     private array $variable = [];
  26.     #[ORM\OneToOne(inversedBy'mailTemplate'cascade: ['persist''remove'])]
  27.     private ?MailAction $action null;
  28.     #[Vich\UploadableField(mapping'attachments'fileNameProperty'fileName'size'imageSize')]
  29.     #[ORM\OneToMany(mappedBy'mailTemplate'targetEntityMailAttachment::class, cascade: ['persist''remove'],orphanRemovaltrue)]
  30.     private Collection $mailAttachments;
  31.     #[ORM\Column]
  32.     private ?bool $isActive null;
  33.     #[ORM\OneToMany(mappedBy'mailTemplate'targetEntityMailQueue::class)]
  34.     private Collection $mailQueues;
  35.     public function __construct()
  36.     {
  37.         $this->mailAttachments = new ArrayCollection();
  38.         $this->mailQueues = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getName(): ?string
  45.     {
  46.         return $this->name;
  47.     }
  48.     public function setName(string $name): self
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function getHtml(): ?string
  54.     {
  55.         return $this->html;
  56.     }
  57.     public function setHtml(string $html): self
  58.     {
  59.         $this->html $html;
  60.         return $this;
  61.     }
  62.     public function getSubject(): ?string
  63.     {
  64.         return $this->subject;
  65.     }
  66.     public function setSubject(string $subject): self
  67.     {
  68.         $this->subject $subject;
  69.         return $this;
  70.     }
  71.     public function getAttachment(): array
  72.     {
  73.         return $this->attachment;
  74.     }
  75.     public function setAttachment(?array $attachment): self
  76.     {
  77.         $this->attachment $attachment;
  78.         return $this;
  79.     }
  80.     public function getVariable(): array
  81.     {
  82.         return $this->variable;
  83.     }
  84.     public function setVariable(?array $variable): self
  85.     {
  86.         $this->variable $variable;
  87.         return $this;
  88.     }
  89.     public function getAction(): ?MailAction
  90.     {
  91.         return $this->action;
  92.     }
  93.     public function setAction(?MailAction $action): self
  94.     {
  95.         $this->action $action;
  96.         return $this;
  97.     }
  98.     /**
  99.      * @return Collection<int, MailAttachment>
  100.      */
  101.     public function getMailAttachments(): Collection
  102.     {
  103.         return $this->mailAttachments;
  104.     }
  105.     public function addMailAttachment(MailAttachment $mailAttachment): static
  106.     {
  107.         if (!$this->mailAttachments->contains($mailAttachment)) {
  108.             $this->mailAttachments->add($mailAttachment);
  109.             $mailAttachment->setMailTemplate($this);
  110.         }
  111.         return $this;
  112.     }
  113.     public function removeMailAttachment(MailAttachment $mailAttachment): static
  114.     {
  115.         if ($this->mailAttachments->removeElement($mailAttachment)) {
  116.             // set the owning side to null (unless already changed)
  117.             if ($mailAttachment->getMailTemplate() === $this) {
  118.                 $mailAttachment->setMailTemplate(null);
  119.             }
  120.         }
  121.         return $this;
  122.     }
  123.     public function isIsActive(): ?bool
  124.     {
  125.         return $this->isActive;
  126.     }
  127.     public function setIsActive(bool $isActive): static
  128.     {
  129.         $this->isActive $isActive;
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return Collection<int, MailQueue>
  134.      */
  135.     public function getMailQueues(): Collection
  136.     {
  137.         return $this->mailQueues;
  138.     }
  139.     public function addMailQueue(MailQueue $mailQueue): static
  140.     {
  141.         if (!$this->mailQueues->contains($mailQueue)) {
  142.             $this->mailQueues->add($mailQueue);
  143.             $mailQueue->setMailTemplate($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removeMailQueue(MailQueue $mailQueue): static
  148.     {
  149.         if ($this->mailQueues->removeElement($mailQueue)) {
  150.             // set the owning side to null (unless already changed)
  151.             if ($mailQueue->getMailTemplate() === $this) {
  152.                 $mailQueue->setMailTemplate(null);
  153.             }
  154.         }
  155.         return $this;
  156.     }
  157. }