Files
lucent-laravel/src/Revision/Revision.php
T

44 lines
933 B
PHP
Raw Normal View History

2023-10-02 23:10:49 +03:00
<?php
namespace Lucent\Revision;
use Illuminate\Support\Str;
2023-10-15 19:14:07 +03:00
use Lucent\Edge\EdgeCollection;
2024-03-23 21:12:07 +02:00
use Lucent\Record\FileInfo;
2023-10-02 23:10:49 +03:00
use Lucent\Record\Record;
use Lucent\Record\RecordData;
use Lucent\Record\System;
readonly class Revision
{
function __construct(
2023-10-15 19:14:07 +03:00
public string $id,
public string $recordId,
public string $schema,
public System $_sys,
public RecordData $data,
public EdgeCollection $_edges,
2024-03-23 21:12:07 +02:00
public ?FileInfo $_file = null,
2023-10-02 23:10:49 +03:00
2023-10-15 19:14:07 +03:00
)
2023-10-02 23:10:49 +03:00
{
}
2023-10-15 19:14:07 +03:00
public static function fromRecord(Record $record, EdgeCollection $edges): Revision
2023-10-02 23:10:49 +03:00
{
return new Revision(
id: (string)Str::uuid(),
recordId: $record->id,
2023-10-04 13:32:30 +03:00
schema: $record->schema,
2023-10-02 23:10:49 +03:00
_sys: $record->_sys,
data: $record->data,
2023-10-15 19:14:07 +03:00
_edges: $edges,
_file: $record->_file
2023-10-02 23:10:49 +03:00
);
}
}