From 093b34db9498d9ce1155c1fd8a59646aa483f85d Mon Sep 17 00:00:00 2001 From: winter Date: Tue, 28 Jan 2025 22:00:20 +0000 Subject: add upload/attach file feature for writing notes --- Digitigrade/Model/NoteAttachment.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Digitigrade/Model') diff --git a/Digitigrade/Model/NoteAttachment.php b/Digitigrade/Model/NoteAttachment.php index 9e6a3d3..1ca0064 100644 --- a/Digitigrade/Model/NoteAttachment.php +++ b/Digitigrade/Model/NoteAttachment.php @@ -10,6 +10,15 @@ class NoteAttachment extends Model { public string $href; public ?string $description; + public static function fromStorageObject(StorageObject $obj, int $index, ?string $description = null) { + $a = new self(); + $a->index = $index; + $a->type = $obj->mimetype; + $a->href = $obj->getUrl(); + $a->description = $description; + return $a; + } + public function setOwnerId(int $id) { $this->noteId = $id; } -- cgit v1.3