neos-development-collection icon indicating copy to clipboard operation
neos-development-collection copied to clipboard

"internal" node properties in Fusion/UI

Open kitsunet opened this issue 1 year ago • 12 comments

Currently there is this in Neos.Neos/NodeTypes/Mixin/Node.yaml

  properties:
    #TODO: IS IT BREAKING TO DISABLE THESE NODE PROPERTIES BELOW WITH ES CR?
    #_creationDateTime:
    #  type: DateTime
    #_lastModificationDateTime:
    #  type: DateTime
    #_lastPublicationDateTime:
    #  type: DateTime
    #_path:
    #  type: string
    #_name:
    #  type: string

And yes unsurprisingly this is breaking in multiple ways. These are assumed ot be there at least in the NodeInfoView but probably in other places, also userland code might use those ala q(node).property('_path') which is perfectly "legal" at the moment. So we need to adapt internal usage and create migrations for userland code if we want to get rid of those (as well as create an accessor for them I guess?)

kitsunet avatar Apr 23 '23 19:04 kitsunet

This is related to #3434 as that is using them. However I have a fix prepared for that.

kitsunet avatar Apr 24 '23 18:04 kitsunet

in 7.3 for example these are the node properties which can be accessed via the internal property syntax:

properties which are declared in the original NodeInterface:

_accessRestrictions
_accessRoles
_accessible
_autoCreated
_childNodes
_contentObject
_context
_contextPath
_depth
_dimensions
_hidden
_hiddenAfterDateTime
_hiddenBeforeDateTime
_hiddenInIndex
_identifier
_index
_label
_name
_node
_nodeData
_nodeType
_nodeTypeAllowedAsChildNode
_otherNodeVariants
_parent
_parentPath
_path
_primaryChildNode
_properties
_property
_propertyNames
_removed
_visible
_workspace

for completion (unrelated but i just wanted to document it) these are the settable properties a la NodeInterface:

_accessRoles
_contentObject
_hidden
_hiddenAfterDateTime
_hiddenBeforeDateTime
_hiddenInIndex
_index
_name
_nodeType
_property
_removed
_workspace

additionally accessible properties because of the TraversableNodeInterface and Node.

_cacheEntryIdentifier
_contentStreamIdentifier
_creationDateTime
_dimensionSpacePoint
_lastModificationDateTime
_lastPublicationDateTime
_nodeAggregateIdentifier
_nodeName
_nodeTypeName
_numberOfChildNodes
_originDimensionSpacePoint
_root
_tethered

_path and _identifier are still supported in the new 9.0 cr:

https://github.com/neos/neos-development-collection/blob/8d7acb506d87c76b47bf9114dddd696bee15fdab/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PropertyOperation.php#L93C1-L100

but since we kept the dynamic internal access in 9.0

if ($propertyName[0] === '_') {
    return ObjectAccess::getPropertyPath($element, substr($propertyName, 1));
}

we will also allow in the future some magic wizardry for these (new) 9.0 properties:

_subgraphIdentity
_nodeAggregateId
_originDimensionSpacePoint
_classification
_nodeTypeName
_nodeType
_properties
_nodeName
_timestamps

im against that. Keeping a legacy layer: Ok but i would refrain from allowing new magic accessors.

also there are futher cases like here: https://github.com/neos/neos-development-collection/blob/7ac994259f5ee637533dd1a9e1fd8516688b386d/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FilterOperation.php#L123

mhsdesign avatar Jun 02 '23 08:06 mhsdesign

Suggestion mentioned in daily today is to actually fully abandon these as it will just lead to confusion with people when some still work. Lets rather migrate them and offer alternatives where it makes sense.

kitsunet avatar Nov 24 '23 13:11 kitsunet

100% agree.

Additionally we should discuss if _hiddenInIndex - which in 8.3 was a magic property and now in 9.0 is a normal but untypical property due to the underscore - should be renamed to hiddenInIndex. Otherwise we could say this is the last core property which requires an underscore.

mhsdesign avatar Nov 24 '23 14:11 mhsdesign

Please check also the already created rector migrations: https://github.com/neos/rector/pull/39

dlubitz avatar Jan 03 '24 19:01 dlubitz

To avoid confusion, and since we have rector migrations in place, we decided in the weekly that we wanted to drop the legacy layer: https://github.com/neos/neos-development-collection/blob/8d7acb506d87c76b47bf9114dddd696bee15fdab/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PropertyOperation.php#L93C1-L100 and not further support the underscore _ syntax anymore.

We should especially look at some node types as the underscore _ syntax is there still used for example to define an editor for the _nodeType but that should rather be either hardcoded in the ui or declared elsewhere. I think neos 9 doesnt need the concept of underscores for untypical properties anymore, and they are opened for consumer land to be used freely.

mhsdesign avatar Jan 12 '24 13:01 mhsdesign

Unfortunately we actually added _hidden and _hiddenInIndex into the property declaration and use them as regular properties now, they are just in the json like anything else. Seems a bit big break to change that still?

kitsunet avatar Jan 19 '24 09:01 kitsunet

What about a NodeMigration to rename the property?

dlubitz avatar Jan 19 '24 09:01 dlubitz

But rename it to what? 😆 The thing is ... complicated, I can explain in the weekly... or write it out here later.

kitsunet avatar Jan 19 '24 09:01 kitsunet

_hidden and _nodeType must go from the nodeType yaml imo.

mhsdesign avatar Jan 19 '24 09:01 mhsdesign

As decided in our weekly today, the plan is to:

  • Rename _hiddenInIndex to hiddenInMenu
  • Remove _hidden
  • Replace all remaining underscore properties in the core
  • Remove special handling for underscores in properties

bwaidelich avatar Jan 19 '24 10:01 bwaidelich

Todo: explicit eel ordering support via time stamp fields: https://neos-project.slack.com/archives/C050C8FEK/p1709887830143079?thread_ts=1709403062.357079&cid=C050C8FEK

currently in 9.0-dev its sort('_timestamps.originalCreated')

mhsdesign avatar Mar 08 '24 16:03 mhsdesign