query and graph

This commit is contained in:
2024-03-23 21:12:07 +02:00
parent b8efa5f586
commit c649077e37
33 changed files with 4335 additions and 908 deletions
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace Lucent\Record;
use stdClass;
class Mapper
{
public function __construct(
public InputFormatter $inputFormatter
)
{
}
public function fromDB(stdClass $data): Record
{
$record = match (true) {
!empty($data->_file) => File::fromDB($data),
default => Document::fromDB($data),
};
$record->data = $this->inputFormatter->fill($record->schema, $record->data);
return $record;
}
}