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(targetEntityBuilding::class, inversedBy'buildingDocuments'fetch'EAGER')]
  29.     private ?Building $building null;
  30.     #[ORM\ManyToOne(inversedBy'buildingDocuments')]
  31.     private ?Residence $residence null;
  32.     #[ORM\Column(nullablefalse)]
  33.     private ?int $complexPropertyId null;
  34.     public function __construct()
  35.     {
  36.         $this->createdAt = new \DateTimeImmutable('now', new \DateTimeZone('Europe/Paris'));
  37.         $this->uploadedAt = new \DateTime('now', new \DateTimeZone('Europe/Paris'));
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(?string $name): self
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     public function getCreatedAt(): ?\DateTimeInterface
  53.     {
  54.         return $this->createdAt;
  55.     }
  56.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  57.     {
  58.         $this->createdAt $createdAt;
  59.         return $this;
  60.     }
  61.     public function getUploadedAt(): ?\DateTimeInterface
  62.     {
  63.         return $this->uploadedAt;
  64.     }
  65.     public function setUploadedAt(?\DateTimeInterface $uploadedAt): self
  66.     {
  67.         $this->uploadedAt $uploadedAt;
  68.         return $this;
  69.     }
  70.     public function getImageFile(): ?string
  71.     {
  72.         return $this->imageFile;
  73.     }
  74.     public function setImageFile(?string $imageFile): self
  75.     {
  76.         $this->imageFile $imageFile;
  77.         return $this;
  78.     }
  79.     public function getBuilding(): ?Building
  80.     {
  81.         return $this->building;
  82.     }
  83.     public function setBuilding(?Building $building): self
  84.     {
  85.         $this->building $building;
  86.         return $this;
  87.     }
  88.     public function getComplexPropertyId(): ?int
  89.     {
  90.         return $this->complexPropertyId;
  91.     }
  92.     public function setComplexPropertyId(?int $complexPropertyId): self
  93.     {
  94.         $this->complexPropertyId $complexPropertyId;
  95.         return $this;
  96.     }
  97.     /**
  98.      * @return File|null
  99.      */
  100.     public function getPicture(): ?File
  101.     {
  102.         return $this->picture;
  103.     }
  104.     /**
  105.      * @param File|null $picture
  106.      */
  107.     public function setPicture(?File $picture): self
  108.     {
  109.         $this->picture $picture;
  110.         return $this;
  111.     }
  112.     public function getResidence(): ?Residence
  113.     {
  114.         return $this->residence;
  115.     }
  116.     public function setResidence(?Residence $residence): self
  117.     {
  118.         $this->residence $residence;
  119.         return $this;
  120.     }
  121. }