WIP: Implement uploads
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Entity;
|
||||
|
||||
use App\Entity\Traits\BlameableEntity;
|
||||
use App\Entity\Traits\TimestampableEntity;
|
||||
use App\Model\UploadDto;
|
||||
use App\Repository\UploadRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
@@ -14,6 +15,8 @@ class Upload implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
use BlameableEntity;
|
||||
use TimestampableEntity;
|
||||
|
||||
public const TYPE_PHOTO = 'photo';
|
||||
|
||||
public const STATUS_NEW = 'new';
|
||||
public const STATUS_IN_PROCESS = 'in_process';
|
||||
public const STATUS_CHECKED = 'checked';
|
||||
@@ -52,6 +55,21 @@ class Upload implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
$this->uuid = Uuid::v4();
|
||||
}
|
||||
|
||||
public static function fromUploadDto(UploadDto $uploadDto, User $owner, string $type): static
|
||||
{
|
||||
$instance = new static();
|
||||
$instance
|
||||
->setFilename($uploadDto->getFilename())
|
||||
->setOriginalFilename($uploadDto->getOriginalFilename())
|
||||
->setMimeType($uploadDto->getMimeType())
|
||||
->setSize($uploadDto->getSize())
|
||||
->setOwner($owner)
|
||||
->setType($type)
|
||||
;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
|
||||
Reference in New Issue
Block a user