mirror of
https://github.com/danog/Valinor.git
synced 2024-12-02 09:37:46 +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'); ``` |
||
---|---|---|
.. | ||
img | ||
mapping | ||
other | ||
stylesheets | ||
changelog.md | ||
credits.md | ||
getting-started.md | ||
index.md | ||
message-customization.md | ||
robots.txt | ||
source.md | ||
validation.md |