lots
This commit is contained in:
@@ -15,6 +15,7 @@ readonly class Revision
|
||||
function __construct(
|
||||
public string $id,
|
||||
public string $recordId,
|
||||
public string $schema,
|
||||
public System $_sys,
|
||||
public RecordData $data,
|
||||
public ?File $_file = null,
|
||||
@@ -22,12 +23,6 @@ readonly class Revision
|
||||
{
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return json_decode(json_encode($this), true);
|
||||
}
|
||||
|
||||
|
||||
public static function fromDB(stdClass $data): Revision
|
||||
{
|
||||
|
||||
@@ -42,6 +37,7 @@ readonly class Revision
|
||||
return new Revision(
|
||||
id: $data->id,
|
||||
recordId: $data->recordId,
|
||||
schema: $data->schema,
|
||||
_sys: System::fromArray(json_decode($data->_sys, true)),
|
||||
data: new RecordData(json_decode($data->data, true)),
|
||||
_file: $file,
|
||||
@@ -53,6 +49,7 @@ readonly class Revision
|
||||
return [
|
||||
"id" => $this->id,
|
||||
"recordId" => $this->recordId,
|
||||
"schema" => $this->schema,
|
||||
"_sys" => json_encode($this->_sys),
|
||||
"_file" => json_encode($this->_file),
|
||||
"data" => json_encode($this->data),
|
||||
@@ -65,6 +62,7 @@ readonly class Revision
|
||||
return new Revision(
|
||||
id: (string)Str::uuid(),
|
||||
recordId: $record->id,
|
||||
schema: $record->schema,
|
||||
_sys: $record->_sys,
|
||||
data: $record->data,
|
||||
_file: $record->_file,
|
||||
|
||||
Reference in New Issue
Block a user