BUGFIX: handle DateTimeImmutable node property in neos ui#5723
Draft
BUGFIX: handle DateTimeImmutable node property in neos ui#5723
DateTimeImmutable node property in neos ui#5723Conversation
With Neos 9 we fully ensure that `DateTimeImmutable` are used in node properties. `DateTime` is an alias for `DateTimeImmutable` when used als type. Thats why we often refer to `DateTimeImmutable` already in the tests. Being used to that and reading that it works on the core i was suprised that the Ui crashes. A missing declaration is the crux here as without the override `typeConverter` here the Neos Ui will use the `Neos\Flow\Property\TypeConverter\ArrayFromObjectConverter` which is not incredibly clever when it comes to dates and plain dies: ``` DateTimeZone::getOffset() expects exactly 1 argument, 0 given 87 DateTimeZone::getOffset() 86 Neos\Utility\ObjectAccess::getPropertyInternal(DateTimeZone, "offset", false, true) 85 Neos\Utility\ObjectAccess::getGettableProperties(DateTimeZone) 84 Neos\Flow\Property\TypeConverter\ArrayFromObjectConverter_Original::getSourceChildPropertiesToBeConverted(DateTimeZone) 83 Neos\Flow\Property\PropertyMapper_Original::doMapping(DateTimeZone, "array", Neos\Flow\Property\PropertyMappingConfiguration, array|1|) 82 Neos\Flow\Property\PropertyMapper_Original::doMapping(DateTimeImmutable, "array", Neos\Flow\Property\PropertyMappingConfiguration, array|1|) 81 Neos\Flow\Property\PropertyMapper_Original::convert(DateTimeImmutable, "array", Neos\Flow\Property\PropertyMappingConfiguration) 80 Neos\Neos\Ui\Domain\Service\NodePropertyConverterService_Original::convertValue(DateTimeImmutable, "DateTimeImmutable") ```
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

With Neos 9 we fully ensure that
DateTimeImmutableare used in node properties.DateTimeis an alias forDateTimeImmutablewhen used as type. Thats why we often refer toDateTimeImmutablealready in the tests. Being used to that and knowing that it works on the core i was surprised that the Ui crashes. A missing declaration is the crux here as without the overridetypeConverterhere the Neos Ui will use theNeos\Flow\Property\TypeConverter\ArrayFromObjectConverterwhich is not incredibly clever when it comes to dates and plain dies:Upgrade instructions
Review instructions
Checklist
FEATURE|TASK|BUGFIX!!!and have upgrade-instructions