Skip to content

DISCUSSION: Should property: null be ignored? #41

Open
@mhsdesign

Description

When building a more complex template and a loop, you might encounter the situation, when you only want to set this property on iteration 1 or something and otherwise return null, thinking it will be ignored.

Currently the behaviour with null might not be 100% obvious.

template:
  properties:
    someSimplePropertyWithDefaultValue: null
    someReferencePropery: null
    someReferencesProperty: [null]

in the first case someSimplePropertyWithDefaultValue will be set to null (see $node->getProperties()) (also see somewhat related discussion about properties without default value or not previous value beeing skipped: neos/neos-development-collection#4292)

in the latter cases with the reference properties, the null value will be (rightfully) ignored, but because the setProperty will guard this:

https://github.com/neos/neos-development-collection/blob/1b744c8a6959a4aae735ffc6dd360f33847c98aa/Neos.ContentRepository/Classes/Domain/Model/AbstractNodeData.php#L167-L188C1

the question i asked myself, if it would be generally expected, that when null is returned, that the setProperty operation will be skipped for the property.

This would be helpful for cases, where you dont want to hardcode the default value. But this change might be breaking in unexpected ways...

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions