47 lines
998 B
PHP
47 lines
998 B
PHP
<?php
|
|
|
|
namespace Lucent\Revision;
|
|
|
|
use Illuminate\Support\Str;
|
|
use Lucent\Edge\Edge;
|
|
use Lucent\Edge\EdgeCollection;
|
|
use Lucent\Primitive\Collection;
|
|
use Lucent\Record\File;
|
|
use Lucent\Record\Record;
|
|
use Lucent\Record\RecordData;
|
|
use Lucent\Record\System;
|
|
use stdClass;
|
|
|
|
readonly class Revision
|
|
{
|
|
|
|
function __construct(
|
|
public string $id,
|
|
public string $recordId,
|
|
public string $schema,
|
|
public System $_sys,
|
|
public RecordData $data,
|
|
public EdgeCollection $_edges,
|
|
public ?File $_file = null,
|
|
|
|
)
|
|
{
|
|
}
|
|
|
|
|
|
public static function fromRecord(Record $record, EdgeCollection $edges): Revision
|
|
{
|
|
return new Revision(
|
|
id: (string)Str::uuid(),
|
|
recordId: $record->id,
|
|
schema: $record->schema,
|
|
_sys: $record->_sys,
|
|
data: $record->data,
|
|
_edges: $edges,
|
|
_file: $record->_file
|
|
);
|
|
}
|
|
|
|
|
|
}
|