Open
Description
Hi @yordadev
I am working an PoC internally to prove this package helps us converting raw data to DTOs
I have an example with 2 nested DTOs and an Assembler, but the Assembler is not used to assemble the related DTOs.
class ExampleAssembler extends ArgonautAssembler
{
public static function toMainDTO(object $input): MainDTO
{
return new MainDTO([
// ...
'subs' => Collection::class.':'.SubDTO::class
]);
}
public static function toSubDTO(object $input): SubDTO
{
return new SubDTO([
// ...
'aKey' => 'a_key',
]);
}
}
Calling it like;
$assembled = ExampleAssembler::fromCollection($data, MainDTO::class);
This works fine. It ends up with an Collection of SubDTO's but it is not using the mapping inside the toSubDTO
method.
SInce internally the assember just casts to the collection with objects given.
My response is for example with a_key
and I want this to be mapped to aKey
since we'd like to use camelCase.
Therefore , the DTO's aKey stays empty, since it cannot map the data.
Regards, Bert
Metadata
Metadata
Assignees
Labels
No labels