<?php
namespace App\Entity;
use App\Entity\Order;
use App\Entity\Bestandsoort;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\HttpFoundation\File\File;
#[ORM\Entity]
#[Vich\Uploadable]
class Attachment
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable:true)]
private ?string $name = null;
#[ORM\Column(type: 'integer', nullable:true)]
private ?int $size = null;
#[Vich\UploadableField(mapping:'post_attachments', fileNameProperty:'name', size: 'size')]
private $attachmentFile;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $updatedAt = null;
#[ORM\ManyToOne(targetEntity: "Order", inversedBy: 'attachments')]
private ?order $orderid = null;
#[ORM\Column]
private ?bool $uitgelicht = null;
#[ORM\ManyToOne]
private ?bestandsoort $bestandsoort = null;
public function __toString(): string
{
return $this->name;
}
public function __construct()
{
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getPath(): ?string
{
return $this->path;
}
public function setPath(string $path): self
{
$this->path = $path;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getOrderid(): ?order
{
return $this->orderid;
}
public function setOrderid(?order $orderid): self
{
$this->orderid = $orderid;
return $this;
}
public function setAttachmentFile(?File $attachmentFile): void
{
$this->attachmentFile = $attachmentFile;
if ($attachmentFile){
$this->updatedAt = new \DateTime();
}
}
public function getAttachmentFile(){
return $this->attachmentFile;
}
public function getSize(): ?int
{
return $this->size;
}
public function setSize(?int $size): self
{
$this->size = $size;
return $this;
}
public function isUitgelicht(): ?bool
{
return $this->uitgelicht;
}
public function setUitgelicht(bool $uitgelicht): self
{
$this->uitgelicht = $uitgelicht;
return $this;
}
public function getBestandsoort(): ?bestandsoort
{
return $this->bestandsoort;
}
public function setBestandsoort(?bestandsoort $bestandsoort): static
{
$this->bestandsoort = $bestandsoort;
return $this;
}
}