WIP: Implement document handling

This commit is contained in:
Björn Fromme
2023-10-12 10:41:31 +02:00
parent 3e7ca7e166
commit 46915955b0
18 changed files with 529 additions and 49 deletions
+18 -2
View File
@@ -19,6 +19,7 @@ class Upload implements BlameableEntityInterface, TimestampableEntityInterface
public const TYPE_CERTIFICATE = 'certificate';
public const TYPE_CONTRACT = 'contract';
public const TYPE_INVOICE = 'invoice';
public const TYPE_DOCUMENT = 'document';
public const STATUS_NEW = 'new';
public const STATUS_IN_PROCESS = 'in_process';
@@ -46,6 +47,9 @@ class Upload implements BlameableEntityInterface, TimestampableEntityInterface
#[ORM\Column(length: 255)]
private ?string $originalFilename = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $displayName = null;
#[ORM\Column]
private ?int $size = null;
@@ -60,9 +64,9 @@ class Upload implements BlameableEntityInterface, TimestampableEntityInterface
$this->uuid = Uuid::v4();
}
public static function fromUploadDto(UploadDto $uploadDto, User $owner, string $type): static
public static function fromUploadDto(UploadDto $uploadDto, User $owner, string $type, Upload $instance = null): static
{
$instance = new static();
$instance = $instance ?? new static();
$instance
->setFilename($uploadDto->getFilename())
->setOriginalFilename($uploadDto->getOriginalFilename())
@@ -133,6 +137,18 @@ class Upload implements BlameableEntityInterface, TimestampableEntityInterface
return $this;
}
public function getDisplayName(): ?string
{
return $this->displayName;
}
public function setDisplayName(?string $displayName): static
{
$this->displayName = $displayName;
return $this;
}
public function getSize(): ?int
{
return $this->size;