src/Entity/EmailRequest.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EmailRequestRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. #[ORM\Entity(repositoryClass: EmailRequestRepository::class)]
  9. #[Vich\Uploadable]
  10. class EmailRequest
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id = null;
  16.     #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
  17.     private ?\DateTimeInterface $CreatedAt = null;
  18.     #[ORM\ManyToOne]
  19.     private ?user $CreatedBy = null;
  20.     #[ORM\Column(length: 255, nullable: true)]
  21.     private ?string $Subject = null;
  22.     #[ORM\Column(type: Types::TEXT, nullable: true)]
  23.     private ?string $EmailBody = null;
  24.     #[ORM\Column(length: 255, nullable: true)]
  25.     private ?string $Distination = null;
  26.     #[ORM\Column(nullable: true)]
  27.     private ?int $Status = null;
  28.     #[ORM\Column(type: Types::TEXT, nullable: true)]
  29.     private ?string $ErrorMessage = null;
  30.     #[ORM\Column(length: 100, nullable: true)]
  31.     private ?string $RequestRoute = null;
  32.     // NOTE: This is not a mapped field of entity metadata, just a simple property.
  33.     #[Vich\UploadableField(mapping: 'file_attachement', fileNameProperty: 'fileName', size: 'fileSize')]
  34.     private ?File $AttachementFile = null;
  35.     #[ORM\Column(nullable: true)]
  36.     private ?string $fileName = null;
  37.     #[ORM\Column(nullable: true)]
  38.     private ?int $fileSize = null;
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getCreatedAt(): ?\DateTimeInterface
  44.     {
  45.         return $this->CreatedAt;
  46.     }
  47.     public function setCreatedAt(?\DateTimeInterface $CreatedAt): self
  48.     {
  49.         $this->CreatedAt = $CreatedAt;
  50.         return $this;
  51.     }
  52.     public function getCreatedBy(): ?user
  53.     {
  54.         return $this->CreatedBy;
  55.     }
  56.     public function setCreatedBy(?user $CreatedBy): self
  57.     {
  58.         $this->CreatedBy = $CreatedBy;
  59.         return $this;
  60.     }
  61.     public function getSubject(): ?string
  62.     {
  63.         return $this->Subject;
  64.     }
  65.     public function setSubject(?string $Subject): self
  66.     {
  67.         $this->Subject = $Subject;
  68.         return $this;
  69.     }
  70.     public function getEmailBody(): ?string
  71.     {
  72.         return $this->EmailBody;
  73.     }
  74.     public function setEmailBody(?string $EmailBody): self
  75.     {
  76.         $this->EmailBody = $EmailBody;
  77.         return $this;
  78.     }
  79.     public function getDistination(): ?string
  80.     {
  81.         return $this->Distination;
  82.     }
  83.     public function setDistination(?string $Distination): self
  84.     {
  85.         $this->Distination = $Distination;
  86.         return $this;
  87.     }
  88.     public function getStatus(): ?int
  89.     {
  90.         return $this->Status;
  91.     }
  92.     public function setStatus(?int $Status): self
  93.     {
  94.         $this->Status = $Status;
  95.         return $this;
  96.     }
  97.     public function getErrorMessage(): ?string
  98.     {
  99.         return $this->ErrorMessage;
  100.     }
  101.     public function setErrorMessage(?string $ErrorMessage): self
  102.     {
  103.         $this->ErrorMessage = $ErrorMessage;
  104.         return $this;
  105.     }
  106.     public function getRequestRoute(): ?string
  107.     {
  108.         return $this->RequestRoute;
  109.     }
  110.     public function setRequestRoute(?string $RequestRoute): self
  111.     {
  112.         $this->RequestRoute = $RequestRoute;
  113.         return $this;
  114.     }
  115.     /**
  116.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  117.      * of 'UploadedFile' is injected into this setter to trigger the update. If this
  118.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  119.      * must be able to accept an instance of 'File' as the bundle will inject one here
  120.      * during Doctrine hydration.
  121.      *
  122.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $AttachementFile
  123.      */
  124.     public function setAttachementFile(?File $AttachementFile = null): void
  125.     {
  126.         $this->AttachementFile = $AttachementFile;
  127.         if (null !== $AttachementFile) {
  128.             // It is required that at least one field changes if you are using doctrine
  129.             // otherwise the event listeners won't be called and the file is lost
  130.             $this->updatedAt = new \DateTimeImmutable();
  131.         }
  132.     }
  133.     public function getAttachementFile(): ?File
  134.     {
  135.         return $this->AttachementFile;
  136.     }
  137.     public function setFileName(?string $fileName): void
  138.     {
  139.         $this->fileName = $fileName;
  140.     }
  141.     public function getFileName(): ?string
  142.     {
  143.         return $this->fileName;
  144.     }
  145.     public function setFileSize(?int $fileSize): void
  146.     {
  147.         $this->fileSize = $fileSize;
  148.     }
  149.     public function getFileSize(): ?int
  150.     {
  151.         return $this->fileSize;
  152.     }
  153. }