This commit is contained in:
2026-01-13 18:20:01 +02:00
parent 268c696d64
commit 64e067eb59
10 changed files with 144 additions and 47 deletions
+30 -1
View File
@@ -1,7 +1,9 @@
<?php namespace Lucent\Core\File;
use Lucent\Core\Data\RecordFile;
use Lucent\Core\Data\RecordFilePreview;
use Lucent\Core\Data\RecordMode;
use Lucent\Core\Data\File;
use stdClass;
class RecordFileModule
@@ -23,7 +25,7 @@ class RecordFileModule
{
return new RecordFile(
id: data_get($data, "id"),
recordId: data_get($data, "recordId"),
recordId: data_get($data, "record_id"),
fileId: data_get($data, "file_id"),
fieldId: data_get($data, "field_id"),
mode: RecordMode::from(data_get($data, "mode")),
@@ -31,4 +33,31 @@ class RecordFileModule
rank: data_get($data, "rank"),
);
}
public static function recordFilePreviewFromDb(
stdClass $data,
): RecordFilePreview {
return new RecordFilePreview(
new RecordFile(
id: data_get($data, "record_file_id"),
recordId: data_get($data, "record_id"),
fileId: data_get($data, "file_id"),
fieldId: data_get($data, "field_id"),
mode: RecordMode::from(data_get($data, "mode")),
locale: data_get($data, "locale"),
rank: data_get($data, "rank"),
),
new File(
id: data_get($data, "file_id"),
name: data_get($data, "name"),
size: data_get($data, "size"),
width: data_get($data, "width"),
height: data_get($data, "height"),
mime: data_get($data, "mime"),
checksum: data_get($data, "checksum"),
recordId: data_get($data, "recordId"),
isShared: data_get($data, "is_shared"),
),
);
}
}