Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Neos Ui JSON serializable property values #3723

Draft
wants to merge 2 commits into
base: 9.0
Choose a base branch
from

Commits on Feb 17, 2024

  1. BUGFIX: Neos Ui JSON serializable property values

    Ports neos/neos-development-collection#4638 to the Neos Ui, as the class was moved in Neos 9.
    
    Original commit message:
    
    This bugfix will make use of the \JsonSerializable interface instead directly when serializing properties for the neos ui.
    
    With neos/flow-development-collection#2762 native support for vo's in `flow_json_array` was introduced.
    
    That also allows value object support for node properties, as they can be stored directly the node properties flow_json_array.
    
    Unfortunately the property serialisation for the NeosUi does NOT use the expected `\JsonSerializable::jsonSerialize` but the property mapper and the `ArrayFromObjectConverter` for object types to get an array that will be json encoded.
    
    This works mostly fine but in some cases it fails:
    - when your `fromArray` fields and property names values dont match
    - when a "object" subtypes the object mapper is no convertable like the `GuzzleHttp\Psr7\Uri`:
    
    ```
    Too few arguments to function GuzzleHttp\Psr7\Uri::isAbsolute(), 0 passed in /core/neos-manufacture-highest/Packages/Framework/Neos.Utility.ObjectHandling/Classes/ObjectAccess.php on line 151 and exactly 1 expected
    ```
    
    Current workarounds are aop:
    https://github.com/sitegeist/Sitegeist.InspectorGadget/blob/78f5f4a206287b1c4bedf5cb88582ed51cb4a311/Classes/Infrastructure/NodeInfo/NodeInfoPostProcessingAspect.php#L17
    Or to use a dumb property mapper:
    https://github.com/sitegeist/Sitegeist.Archaeopteryx/blob/9322b9cb8e4824bcaf7aaa247c23b1244a2f1167/Classes/LinkToArrayForNeosUiConverter.php#L12C16-L12C78
    mhsdesign committed Feb 17, 2024
    Configuration menu
    Copy the full SHA
    9cd2bfa View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a55a423 View commit details
    Browse the repository at this point in the history