-
-
Notifications
You must be signed in to change notification settings - Fork 4
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
Hi there,
First of all; great package!! We're overthinking to replace our own implementation by your package.
Therefore;
We'd like to use a dependency injection and loop over all mapped DTO's to compose objects further.
Would be nice to do this directly from the assembler, since this is still about composing the DTO objects. An example below;
class ExmapleAssembler extends ArgonautAssembler
{
public function __construct(
private readonly ExampleStrategy $strategy,
) {
}
public function toExmpleDto(object $input): ExmpleDto
{
$dto = new ExampleDto([
// ...
]);
$this->strategy->doSomething($dto);
return $dto;
}
}The only change is non-static to methods. But of course this will have effect on the fromArray() and fromCollection() as well.
When it's not static, you can also inject the assembler itself into a service or something too.
Like to hear from you again.
Regards, Bert
yordadev
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request