src/Entity/Document.php line 12

  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.     const NAME_ATTESTATION "attestation";
  12.     const NAME_INVOICE_PACK_ATTESTATION "invoice-packAttestation";
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255nullabletrue)]
  18.     private ?string $name null;
  19.     #[Vich\UploadableField(mapping"user_file"fileNameProperty"imageFile")]
  20.     private ?File $picture null;
  21.     #[ORM\Column]
  22.     private ?\DateTimeImmutable $createdAt null;
  23.     #[ORM\Column(type'datetime')]
  24.     private $uploadedAt;
  25.     #[ORM\ManyToOne(inversedBy'documents')]
  26.     #[ORM\JoinColumn(nullablefalse)]
  27.     private ?HousingCertificate $housingCertificate null;
  28.     #[ORM\ManyToOne(inversedBy'documents')]
  29.     private ?User $user null;
  30.     #[ORM\Column(type'string'length255nullabletrue)]
  31.     private $imageFile;
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $firstName null;
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $lastName null;
  36.     public function __construct()
  37.     {
  38.         $this->createdAt = new \DateTimeImmutable('now', new \DateTimeZone('Europe/Paris'));
  39.         $this->uploadedAt = new \DateTime('now', new \DateTimeZone('Europe/Paris'));
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getName(): ?string
  46.     {
  47.         return $this->name;
  48.     }
  49.     public function setName(?string $name): self
  50.     {
  51.         $this->name $name;
  52.         return $this;
  53.     }
  54.     public function getCreatedAt(): ?\DateTimeImmutable
  55.     {
  56.         return $this->createdAt;
  57.     }
  58.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  59.     {
  60.         $this->createdAt $createdAt;
  61.         return $this;
  62.     }
  63.     public function getUser(): ?User
  64.     {
  65.         return $this->user;
  66.     }
  67.     public function setUser(?User $user): self
  68.     {
  69.         $this->user $user;
  70.         return $this;
  71.     }
  72.     public function getImageFile(): ?string
  73.     {
  74.         return $this->imageFile;
  75.     }
  76.     public function setImageFile(?string $imageFile): self
  77.     {
  78.         $this->imageFile $imageFile;
  79.         return $this;
  80.     }
  81.     public function getUploadedAt()
  82.     {
  83.         return $this->uploadedAt;
  84.     }
  85.     public function setUploadedAt($uploadedAt): void
  86.     {
  87.         $this->uploadedAt $uploadedAt;
  88.     }
  89.     public function getPicture(): ?File
  90.     {
  91.         return $this->picture;
  92.     }
  93.     public function setPicture(?File $picture): self
  94.     {
  95.         $this->picture $picture;
  96.         return $this;
  97.     }
  98.     public function getFirstName(): ?string
  99.     {
  100.         return $this->firstName;
  101.     }
  102.     public function setFirstName(?string $firstName): self
  103.     {
  104.         $this->firstName $firstName;
  105.         return $this;
  106.     }
  107.     public function getLastName(): ?string
  108.     {
  109.         return $this->lastName;
  110.     }
  111.     public function setLastName(?string $lastName): self
  112.     {
  113.         $this->lastName $lastName;
  114.         return $this;
  115.     }
  116.     public function getHousingCertificate(): ?HousingCertificate
  117.     {
  118.         return $this->housingCertificate;
  119.     }
  120.     public function setHousingCertificate(?HousingCertificate $housingCertificate): self
  121.     {
  122.         $this->housingCertificate $housingCertificate;
  123.         return $this;
  124.     }
  125. }