Skip to content
Discussion options

You must be logged in to vote

Hi @eigan, converters are indeed the proper solution. You can use it this way:

(new MapperBuilder())
    ->registerConverter(static function (string $value, callable $next): DateTimeInterface|null {
        return $value === '' ? null : $next($value);
    })
    ->mapper()
    ->map(…);

Hope this solves your issue 😊

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@romm
Comment options

romm Apr 28, 2026
Maintainer

Answer selected by eigan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants