src/Entity/Document.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DocumentRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. #[ORM\Entity(repositoryClassDocumentRepository::class)]
  8. #[Vich\Uploadable]
  9. class Document
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $title null;
  17.     #[Vich\UploadableField(mapping'document'fileNameProperty'documentName')]
  18.     private ?File $documentFile null;
  19.     #[ORM\Column(nullabletrue)]
  20.     private ?string $documentName null;
  21.     #[ORM\Column]
  22.     private ?\DateTimeImmutable $created_at null;
  23.     public function getId(): ?int
  24.     {
  25.         return $this->id;
  26.     }
  27.     public function getTitle(): ?string
  28.     {
  29.         return $this->title;
  30.     }
  31.     public function setTitle(string $title): static
  32.     {
  33.         $this->title $title;
  34.         return $this;
  35.     }
  36.     public function setDocumentFile(?File $documentFile null): void
  37.     {
  38.         $this->documentFile $documentFile;
  39.         if (null !== $documentFile) {
  40.             // It is required that at least one field changes if you are using doctrine
  41.             // otherwise the event listeners won't be called and the file is lost
  42.             $this->updatedAt = new \DateTimeImmutable();
  43.         }
  44.     }
  45.     public function getDocumentFile(): ?File
  46.     {
  47.         return $this->documentFile;
  48.     }
  49.     public function setDocumentName(?string $imageName): void
  50.     {
  51.         $this->documentName $imageName;
  52.     }
  53.     public function getDocumentName(): ?string
  54.     {
  55.         return $this->documentName;
  56.     }
  57.     public function getCreatedAt(): ?\DateTimeImmutable
  58.     {
  59.         return $this->created_at;
  60.     }
  61.     public function setCreatedAt(\DateTimeImmutable $created_at): static
  62.     {
  63.         $this->created_at $created_at;
  64.         return $this;
  65.     }
  66. }