CastWith
This commit is contained in:
parent
bef42b3352
commit
afb47c1977
7 changed files with 56 additions and 26 deletions
|
|
@ -5,7 +5,7 @@ declare(strict_types=1);
|
|||
namespace Icefox\DTO;
|
||||
|
||||
use Icefox\DTO\Attributes\FromInput;
|
||||
use Icefox\DTO\Attributes\FromMapper;
|
||||
use Icefox\DTO\Attributes\CastWith;
|
||||
use Icefox\DTO\Attributes\FromRouteParameter;
|
||||
use Icefox\DTO\Support\RuleFactory;
|
||||
use Icefox\DTO\Support\ValueFactory;
|
||||
|
|
@ -78,7 +78,7 @@ trait DataObject
|
|||
foreach ($parameters as $parameter) {
|
||||
$parameterName = $parameter->reflection->getName();
|
||||
|
||||
if ($mapper = array_first($parameter->reflection->getAttributes(FromMapper::class))) {
|
||||
if ($mapper = array_first($parameter->reflection->getAttributes(CastWith::class))) {
|
||||
$value = App::call(
|
||||
[App::make($mapper->newInstance()->class), 'map'],
|
||||
['value' => $validator->getValue($parameterName)],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue