src/Entity/Attachment.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Order;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. #[ORM\Entity]
  9. #[Vich\Uploadable]
  10. class Attachment
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255nullable:true)]
  17.     private ?string $name null;
  18.     #[ORM\Column(type'integer'nullable:true)]
  19.     private ?int $size null;
  20.     #[Vich\UploadableField(mapping:'post_attachments'fileNameProperty:'name'size'size')]
  21.     private $attachmentFile;
  22.    
  23.  
  24.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  25.     private ?\DateTimeInterface $createdAt null;
  26.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  27.     private ?\DateTimeInterface $updatedAt null;
  28.     #[ORM\ManyToOne(targetEntity"Order"inversedBy'attachments')]
  29.     private ?order $orderid null;
  30.     #[ORM\Column]
  31.     private ?bool $uitgelicht null;
  32.     public function __toString(): string
  33.     {
  34.         return $this->name;
  35.     }
  36.     public function __construct()
  37.     {
  38.         $this->createdAt = new \DateTime();
  39.         $this->updatedAt = new \DateTime();
  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 getPath(): ?string
  55.     {
  56.         return $this->path;
  57.     }
  58.     public function setPath(string $path): self
  59.     {
  60.         $this->path $path;
  61.         return $this;
  62.     }
  63.     public function getCreatedAt(): ?\DateTimeInterface
  64.     {
  65.         return $this->createdAt;
  66.     }
  67.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  68.     {
  69.         $this->createdAt $createdAt;
  70.         return $this;
  71.     }
  72.     public function getUpdatedAt(): ?\DateTimeInterface
  73.     {
  74.         return $this->updatedAt;
  75.     }
  76.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  77.     {
  78.         $this->updatedAt $updatedAt;
  79.         return $this;
  80.     }
  81.     public function getOrderid(): ?order
  82.     {
  83.         return $this->orderid;
  84.     }
  85.     public function setOrderid(?order $orderid): self
  86.     {
  87.         $this->orderid $orderid;
  88.         return $this;
  89.     }
  90.     public function setAttachmentFile(?File $attachmentFile): void
  91.     {
  92.         $this->attachmentFile $attachmentFile;
  93.         if ($attachmentFile){
  94.             $this->updatedAt = new \DateTime();
  95.         }
  96.         
  97.       
  98.         
  99.     }
  100.    
  101.     public function getAttachmentFile(){
  102.         return $this->attachmentFile;
  103.     }
  104.     public function getSize(): ?int
  105.     {
  106.         return $this->size;
  107.     }
  108.     public function setSize(?int $size): self
  109.     {
  110.         $this->size $size;
  111.         return $this;
  112.     }
  113.     public function isUitgelicht(): ?bool
  114.     {
  115.         return $this->uitgelicht;
  116.     }
  117.     public function setUitgelicht(bool $uitgelicht): self
  118.     {
  119.         $this->uitgelicht $uitgelicht;
  120.         return $this;
  121.     }
  122. }