mirror of
https://github.com/danog/Valinor.git
synced 2024-12-12 09:09:38 +01:00
f232cc0636
A new constructor can be registered to declare which format(s) are supported during the mapping of a date object. By default, any valid timestamp or ATOM-formatted value will be accepted. ```php (new \CuyZ\Valinor\MapperBuilder()) // Both COOKIE and ATOM formats will be accepted ->registerConstructor( new \CuyZ\Valinor\Mapper\Object\DateTimeFormatConstructor(DATE_COOKIE, DATE_ATOM) ) ->mapper() ->map(DateTimeInterface::class, 'Monday, 08-Nov-1971 13:37:42 UTC'); ``` The previously very opinionated behaviour has been removed, but can be temporarily used to help with the migration. ```php (new \CuyZ\Valinor\MapperBuilder()) ->registerConstructor( new \CuyZ\Valinor\Mapper\Object\BackwardCompatibilityDateTimeConstructor() ) ->mapper() ->map(DateTimeInterface::class, 'Monday, 08-Nov-1971 13:37:42 UTC'); ``` |
||
---|---|---|
.. | ||
Factory | ||
FunctionObjectBuilderTest.php | ||
MethodArgumentsTest.php | ||
MethodObjectBuilderTest.php | ||
NativeConstructorObjectBuilderTest.php | ||
ReflectionObjectBuilderTest.php |