src/Entity/BuildingDocument.php line 17

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BuildingDocumentRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. use Symfony\Component\Validator\Constraints\DateTime;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. #[ORM\Entity(repositoryClassBuildingDocumentRepository::class)]
  11. #[Vich\Uploadable]
  12. class BuildingDocument
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $name null;
  20.     #[Vich\UploadableField(mapping"building_file"fileNameProperty"imageFile")]
  21.     private ?File $picture null;
  22.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  23.     private ?\DateTimeInterface $createdAt null;
  24.     #[ORM\Column(type'datetime'nullabletrue)]
  25.     private ?\DateTimeInterface $uploadedAt null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $imageFile null;
  28.     #[ORM\ManyToOne(inversedBy'buildingDocuments')]
  29.     private ?Building $building null;
  30.     #[ORM\ManyToOne(inversedBy'buildingDocuments')]
  31.     private ?Residence $residence null;
  32.     public function __construct()
  33.     {
  34.         $this->createdAt = new \DateTimeImmutable('now', new \DateTimeZone('Europe/Paris'));
  35.         $this->uploadedAt = new \DateTime('now', new \DateTimeZone('Europe/Paris'));
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getName(): ?string
  42.     {
  43.         return $this->name;
  44.     }
  45.     public function setName(?string $name): self
  46.     {
  47.         $this->name $name;
  48.         return $this;
  49.     }
  50.     public function getCreatedAt(): ?\DateTimeInterface
  51.     {
  52.         return $this->createdAt;
  53.     }
  54.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  55.     {
  56.         $this->createdAt $createdAt;
  57.         return $this;
  58.     }
  59.     public function getUploadedAt(): ?\DateTimeInterface
  60.     {
  61.         return $this->uploadedAt;
  62.     }
  63.     public function setUploadedAt(?\DateTimeInterface $uploadedAt): self
  64.     {
  65.         $this->uploadedAt $uploadedAt;
  66.         return $this;
  67.     }
  68.     public function getImageFile(): ?string
  69.     {
  70.         return $this->imageFile;
  71.     }
  72.     public function setImageFile(?string $imageFile): self
  73.     {
  74.         $this->imageFile $imageFile;
  75.         return $this;
  76.     }
  77.     public function getBuilding(): ?Building
  78.     {
  79.         return $this->building;
  80.     }
  81.     public function setBuilding(?Building $building): self
  82.     {
  83.         $this->building $building;
  84.         return $this;
  85.     }
  86.     /**
  87.      * @return File|null
  88.      */
  89.     public function getPicture(): ?File
  90.     {
  91.         return $this->picture;
  92.     }
  93.     /**
  94.      * @param File|null $picture
  95.      */
  96.     public function setPicture(?File $picture): self
  97.     {
  98.         $this->picture $picture;
  99.         return $this;
  100.     }
  101.     public function getResidence(): ?Residence
  102.     {
  103.         return $this->residence;
  104.     }
  105.     public function setResidence(?Residence $residence): self
  106.     {
  107.         $this->residence $residence;
  108.         return $this;
  109.     }
  110. }