Map fields from flat structure to objects hierarchy
Field names of root and all levels of proxied objects must be checked for name collisions
forbid cyclic references? inner object names must be resolved before root object
cache must be invalidated for root object when proxied object is changed (only the shared references and names cache)
Proxy should not be allowed to be contained in other rules?
namespace Example\Orisai\ObjectMapper;
use Orisai\ObjectMapper\Attributes\Expect\MappedObjectValue;
use Orisai\ObjectMapper\Attributes\Expect\StringValue;
use Orisai\ObjectMapper\Attributes\Modifiers\FieldName;
use Orisai\ObjectMapper\MappedObject;
use Orisai\ObjectMapper\Processing\Processor;
final class Example extends MappedObject
{
#[MappedObjectValue(Proxied::class, proxy: true)]
public Proxied $proxy;
#[MappedObjectValue(Proxied::class, proxy: true, proxySeparator: '@')]
#[FieldName('changed-name')]
public Proxied $anotherProxy;
}
final class Proxied extends MappedObject
{
#[StringValue]
public string $example;
}
$processor;
assert($processor instanceof Processor);
$processor->process([
'proxy-example' => 'foo',
'changed-name@example' => 'foo',
], Example::class);
Map fields from flat structure to objects hierarchy
Field names of root and all levels of proxied objects must be checked for name collisions
Proxy should not be allowed to be contained in other rules?