-
-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Description
Bug Description
I am not sure, if I am using this right, but I am trying to convert input string to result DateTime object
Steps To Reproduce
https://fiddle.nette.org/nette/#4f2cd78abf
class Foo {
public \DateTime $bar;
}
$processor = new \Nette\Schema\Processor;
$processor->process(
\Nette\Schema\Expect::structure([
'bar' => \Nette\Schema\Expect::string()->castTo('DateTime')
])->castTo(Foo::class),
[
'bar' => '2021-01-01',
]
);
Will result in the error:
Nette\Utils\Arrays::toObject(): Argument #1 ($array) must be of type iterable, string given, called in ...../vendor/nette/schema/src/Schema/Elements/Base.php on line 174
Expected Behavior
Input string will be successfully mapped to target class DateTime property.
Metadata
Metadata
Assignees
Labels
No labels