src/Entity/Documents.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DocumentsRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\UploadedFile;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use ProxyManager\ProxyGenerator\ValueHolder\MethodGenerator\Constructor;
  10. use App\Entity\PropertyList;
  11. use ProxyManager\ProxyGenerator\Util\Properties;
  12. use Symfony\Component\Form\Extension\Core\Type\EnumType;
  13. use Symfony\Component\HttpFoundation\File\File;
  14. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  15. #[ORM\Entity(repositoryClassDocumentsRepository::class)]
  16. #[Vich\Uploadable]
  17. class Documents
  18. {
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column]
  22.     private ?int $id null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $docName null;
  25.     /*
  26.     
  27.     #[Assert\File(
  28.         maxSize:'1024k',
  29.     )]
  30.     
  31.     #[ORM\Column(length: 255, nullable: true)]
  32.     */
  33.     #[Vich\UploadableField(mapping'property_docs'fileNameProperty'docName')]
  34.     private ?File $docType null;
  35. /*
  36.     #[ORM\ManyToOne(inversedBy: 'documents', targetEntity: PropertyList::class, cascade: ['persist', 'remove'])]
  37.     private ?PropertyList $properties = null;
  38. */
  39.     #[ORM\Column(nullabletrue)]
  40.     private ?int $docSize null;
  41.     #[ORM\Column(nullabletrue)]
  42.     private ?\DateTimeImmutable $updatedAt null;
  43.     #[ORM\ManyToOne(inversedBy'documents'cascade: ['persist'])]
  44.     private ?PropertyList $properties null;
  45.     #[ORM\Column(length255nullabletrue)]
  46.     private ?string $docCategory null;
  47.     #[ORM\ManyToOne(inversedBy'document'cascade: ['persist'])]
  48.     private ?Broker $uploadedBy null;
  49.     #[ORM\ManyToOne(inversedBy'document'cascade: ['persist'])]
  50.     private ?User $uploadedByUser null;
  51.     #[ORM\ManyToMany(targetEntityLandlords::class, inversedBy'documents')]
  52.     private Collection $landlord;
  53.     #[ORM\Column(length255nullabletrue)]
  54.     private ?string $energy null;
  55.     #[ORM\Column(length255nullabletrue)]
  56.     private ?string $occupancy null;
  57.     #[Vich\UploadableField(mapping'property_docs'fileNameProperty'occupancy')]
  58.     private ?File $occupancyFile null;
  59.     #[Vich\UploadableField(mapping'property_docs'fileNameProperty'energy')]
  60.     private ?File $energyFile null;
  61. /*
  62.     public function __toString(): string
  63.     {
  64.         return $this->getDocName().' ('.$this->getDocCategory().')';
  65.     }
  66. */
  67.     public function __toString(): string{
  68.         return $this->getDocName() ?? "Sin nombre";
  69.     }
  70.     public function __construct()
  71.     {
  72.         //$this->properties = new ArrayCollection();
  73.         $this->landlord = new ArrayCollection();
  74.     }
  75.     public function getId(): ?int
  76.     {
  77.         return $this->id;
  78.     }
  79.     public function getDocName(): ?string
  80.     {
  81.         return $this->docName;
  82.     }
  83.     public function setDocName(?string $docName): self
  84.     {
  85.         $this->docName $docName;
  86.         return $this;
  87.     }
  88.     /**
  89.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $docType
  90.      */
  91.     public function setDocType(?File $docType null): void
  92.     {
  93.         $this->docType $docType;
  94.         if (null !== $docType) {
  95.             $this->updatedAt = new \DateTimeImmutable();
  96.         }
  97.         //return $this;
  98.     }
  99.     
  100.     public function getDocType(): ?File
  101.     {
  102.         return $this->docType;
  103.     }
  104.     
  105.    
  106.     public function getDocSize(): ?int
  107.     {
  108.         return $this->docSize;
  109.     }
  110.     public function setDocSize(?int $docSize): self
  111.     {
  112.         $this->docSize $docSize;
  113.         return $this;
  114.     }
  115.     public function getUpdatedAt(): ?\DateTimeImmutable
  116.     {
  117.         return $this->updatedAt;
  118.     }
  119.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  120.     {
  121.         $this->updatedAt $updatedAt;
  122.         return $this;
  123.     }
  124.     
  125. /*
  126.     
  127.     public function getProperties(): ?PropertyList
  128.     {
  129.         return $this->properties;
  130.     }
  131.     
  132.     public function setProperties(?PropertyList $properties): self
  133.     {
  134.         $this->properties = $properties;
  135.         return $this;
  136.     }
  137.     public function addProperty(PropertyList $property): self
  138.     {
  139.         if (!$this->properties->contains($property)) {
  140.             $this->properties[] = $property;
  141.             $property->addDocument($this);
  142.         }
  143.         return $this;
  144.     }
  145.     public function removeProperty(PropertyList $property): self
  146.     {
  147.         if ($this->properties->removeElement($property)) {
  148.             $property->removeDocument($this);
  149.         }
  150.         return $this;
  151.     }
  152. */
  153.     public function getProperties(): ?PropertyList
  154.     {
  155.         return $this->properties;
  156.     }
  157.     public function setProperties(?PropertyList $properties): self
  158.     {
  159.         $this->properties $properties;
  160.         return $this;
  161.     }
  162.     public function getDocCategory(): ?string
  163.     {
  164.         return $this->docCategory;
  165.     }
  166.     public function setDocCategory(?string $docCategory): self
  167.     {
  168.         $this->docCategory $docCategory;
  169.         return $this;
  170.     }
  171.     public function getUploadedBy(): ?Broker
  172.     {
  173.         return $this->uploadedBy;
  174.     }
  175.     public function setUploadedBy(?Broker $uploadedBy): self
  176.     {
  177.         $this->uploadedBy $uploadedBy;
  178.         return $this;
  179.     }
  180.     public function getUploadedByUser(): ?User
  181.     {
  182.         return $this->uploadedByUser;
  183.     }
  184.     public function setUploadedByUser(?User $uploadedByUser): self
  185.     {
  186.         $this->uploadedByUser $uploadedByUser;
  187.         return $this;
  188.     }
  189.     /**
  190.      * @return Collection<int, Landlords>
  191.      */
  192.     public function getLandlord(): Collection
  193.     {
  194.         return $this->landlord;
  195.     }
  196.     public function addLandlord(Landlords $landlord): self
  197.     {
  198.         if (!$this->landlord->contains($landlord)) {
  199.             $this->landlord->add($landlord);
  200.         }
  201.         return $this;
  202.     }
  203.     public function removeLandlord(Landlords $landlord): self
  204.     {
  205.         $this->landlord->removeElement($landlord);
  206.         return $this;
  207.     }
  208.     public function getEnergy(): ?string
  209.     {
  210.         return $this->energy;
  211.     }
  212.     public function setEnergy(?string $energy): self
  213.     {
  214.         $this->energy $energy;
  215.         return $this;
  216.     }
  217.     public function getOccupancy(): ?string
  218.     {
  219.         return $this->occupancy;
  220.     }
  221.     public function setOccupancy(?string $occupancy): self
  222.     {
  223.         $this->occupancy $occupancy;
  224.         return $this;
  225.     }
  226.     public function getOccupancyFile(): ?File
  227.     {
  228.         return $this->occupancyFile;
  229.     }
  230.     public function setOccupancyFile(?File $occupancyFile null): void
  231.     {
  232.         $this->occupancyFile $occupancyFile;
  233.         //return $this;
  234.     }
  235.     public function getEnergyFile(): ?File
  236.     {
  237.         return $this->energyFile;
  238.     }
  239.     public function setEnergyFile(?File $energyFile null): void
  240.     {
  241.         $this->energyFile $energyFile;
  242.         //return $this;
  243.     }
  244. }