src/Entity/Files.php line 14

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FilesRepository;
  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: FilesRepository::class)]
  9. #[Vich\Uploadable]
  10. class Files
  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 $CreationAt = null;
  18.     #[ORM\ManyToOne(inversedBy: 'files')]
  19.     private ?User $CreatedBy = null;
  20.     #[ORM\Column(length: 255, nullable: true)]
  21.     private ?string $route = null;
  22.     #[ORM\Column(length: 10, nullable: true)]
  23.     private ?string $Parametre = null;
  24.     // NOTE: This is not a mapped field of entity metadata, just a simple property.
  25.     #[Vich\UploadableField(mapping: 'file_attachement', fileNameProperty: 'fileName', size: 'fileSize')]
  26.     private ?File $AttachementFile = null;
  27.     #[ORM\Column(nullable: true)]
  28.     private ?string $fileName = null;
  29.     #[ORM\Column(nullable: true)]
  30.     private ?int $fileSize = null;
  31.     #[ORM\Column(length: 255, nullable: true)]
  32.     private ?string $Description = null;
  33.     #[ORM\ManyToOne]
  34.     private ?LawOffice $LawOffice = null;
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getCreationAt(): ?\DateTimeInterface
  40.     {
  41.         return $this->CreationAt;
  42.     }
  43.     public function setCreationAt(?\DateTimeInterface $CreationAt): self
  44.     {
  45.         $this->CreationAt = $CreationAt;
  46.         return $this;
  47.     }
  48.     public function getCreatedBy(): ?User
  49.     {
  50.         return $this->CreatedBy;
  51.     }
  52.     public function setCreatedBy(?User $CreatedBy): self
  53.     {
  54.         $this->CreatedBy = $CreatedBy;
  55.         return $this;
  56.     }
  57.     public function getRoute(): ?string
  58.     {
  59.         return $this->route;
  60.     }
  61.     public function setRoute(?string $route): self
  62.     {
  63.         $this->route = $route;
  64.         return $this;
  65.     }
  66.     public function getParametre(): ?string
  67.     {
  68.         return $this->Parametre;
  69.     }
  70.     public function setParametre(?string $Parametre): self
  71.     {
  72.         $this->Parametre = $Parametre;
  73.         return $this;
  74.     }
  75.     /**
  76.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  77.      * of 'UploadedFile' is injected into this setter to trigger the update. If this
  78.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  79.      * must be able to accept an instance of 'File' as the bundle will inject one here
  80.      * during Doctrine hydration.
  81.      *
  82.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $AttachementFile
  83.      */
  84.     public function setAttachementFile(?File $AttachementFile = null): void
  85.     {
  86.         $this->AttachementFile = $AttachementFile;
  87.         if (null !== $AttachementFile) {
  88.             // It is required that at least one field changes if you are using doctrine
  89.             // otherwise the event listeners won't be called and the file is lost
  90.             $this->updatedAt = new \DateTimeImmutable();
  91.         }
  92.     }
  93.     public function getAttachementFile(): ?File
  94.     {
  95.         return $this->AttachementFile;
  96.     }
  97.     public function setFileName(?string $fileName): void
  98.     {
  99.         $this->fileName = $fileName;
  100.     }
  101.     public function getFileName(): ?string
  102.     {
  103.         return $this->fileName;
  104.     }
  105.     public function setFileSize(?int $fileSize): void
  106.     {
  107.         $this->fileSize = $fileSize;
  108.     }
  109.     public function getFileSize(): ?int
  110.     {
  111.         return $this->fileSize;
  112.     }
  113.     public function getDescription(): ?string
  114.     {
  115.         return $this->Description;
  116.     }
  117.     public function setDescription(?string $Description): self
  118.     {
  119.         $this->Description = $Description;
  120.         return $this;
  121.     }
  122.     public function getLawOffice(): ?LawOffice
  123.     {
  124.         return $this->LawOffice;
  125.     }
  126.     public function setLawOffice(?LawOffice $LawOffice): self
  127.     {
  128.         $this->LawOffice = $LawOffice;
  129.         return $this;
  130.     }
  131. }