#111622Map request arguments to DateTimeImmutable properties
Description
Extbase persists and reconstitutes \DateTimeImmutable properties of domain models, and the DateTimeValidator accepts them. The property mapper does not: the DateTimeConverter is registered for the target type DateTime only and returns a \DateTime. A \DateTimeImmutable action argument or a \DateTimeImmutable property of a submitted object or a demand passed in a link cannot be mapped from the request.
The property mapper should convert the same sources (string, integer, array with date, dateFormat, hour, minute, second and timezone) into \DateTimeImmutable as well, with the same configuration options (CONFIGURATION_DATE_FORMAT) and the same errors as for \DateTime. Ideally \DateTimeInterface as target type maps too.
Background: models should prefer immutable dates. Extbase detects a \DateTime that is modified in place because the clean state tracker compares a clone of the original with ==. An ORM that compares by identity, like doctrine/orm, does not see such a change. With \DateTimeImmutable the value has to be replaced, which every comparison detects. Recommending immutable dates needs the property mapper to support them.
Found with the round trip tests for #111621, where a \DateTimeImmutable property of a link argument cannot be mapped back.
Reviews 1
History 01
-
Gerrit Code Review pushed patch set 1 for main to change 98074 status
NewUnder Review 11/26/26, 14:25