-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
Translation layer for Node
read-model in Fusion to restore 8.3 syntax
#5022
Labels
Comments
mhsdesign
changed the title
WIP: Translation layer for
WIP: Translation layer for Apr 30, 2024
Node
read-model in Fusion to restore 8.3 szNode
read-model in Fusion to restore 8.3 syntax
This was referenced Apr 30, 2024
Open
mhsdesign
changed the title
WIP: Translation layer for
Translation layer for May 3, 2024
Node
read-model in Fusion to restore 8.3 syntaxNode
read-model in Fusion to restore 8.3 syntax
Notes from our weekly 2024-05-03
Notes from our weekly 2024-05-10
Idea: |
mhsdesign
added a commit
to mhsdesign/neos-development-collection
that referenced
this issue
May 12, 2024
6 tasks
mhsdesign
added a commit
to mhsdesign/neos-development-collection
that referenced
this issue
May 12, 2024
mhsdesign
added a commit
to mhsdesign/neos-development-collection
that referenced
this issue
May 12, 2024
6 tasks
mhsdesign
added a commit
to mhsdesign/neos-development-collection
that referenced
this issue
May 12, 2024
mhsdesign
added a commit
to mhsdesign/neos-development-collection
that referenced
this issue
May 12, 2024
mhsdesign
added a commit
to mhsdesign/neos-development-collection
that referenced
this issue
May 13, 2024
neos-bot
pushed a commit
to neos/contentrepository-nodeaccess
that referenced
this issue
May 13, 2024
neos-bot
pushed a commit
to neos/contentrepositoryregistry
that referenced
this issue
May 13, 2024
neos-bot
pushed a commit
to neos/neos
that referenced
this issue
May 13, 2024
This was referenced Sep 24, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
intro
For simplicity we should add a translation layer which will allow the well known Neos 8.3 syntax of working with Nodes in EEL/Fusion. Among some other missed properties are:
${node.identifier}
${node.nodeType}
${node.label}
While we have rector migrations for nearly every use-case it will be hard to teach the new often too verbose and hard to understand and find out syntax.
This was discussed and endorsed together in todays weekly (30.04) with @ahaeslich @Sebobo @skurfuerst and me
problems
strict (non string-able) value objects in eel
With #4156 we made value objects stricter and removed their ability to be auto casted to strings. That means instead of writing
${node.nodeAggregateId}
one needs to write${node.nodeAggregateId.value}
This caused a big controversy which is only partly documented here but was also discussed in several meetings:
#4156 (comment)
We concur that having to try out
.value
only sometimes in certain scenarios will be super frustrating and hard to use. EEL was made in times where people were not using php like this and is best used with primitives / objects that have getters with primitives.enums in eel
Enums cannot be easily compared except by accessing its value like
node.classification.value == 'tethered'
.Thats why we added helper
is*
methods on the enum:neos-development-collection/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAggregateClassification.php
Line 54 in ee36cc2
but ideally this would not be necessary.
abbreviations,
id
instead ofidentifier
in some placesWith Neos 9 we deliberately changed
Node::nodeAggregateIdentifier
toNode::nodeAggregateId
(see #5024)The rule to consistently use abbreviations originated from when there was not such good code autocompletion and linting in php. Modern day IDE's like phpstorm make it a breeze to work with either of them as you just check whats available.
But this is not true for Fusion and EEL. Here time dials back and many user use the try and error approach. And here it is generally easier to work with if you have a few rules in your head which you know they apply like: No abbreviations.
solutions
introduce a high level API around Nodes
An abstraction on the php side which is more capable and god like. Could, if done consistently, be rewarding. But this comes with a huge overhead. The idea around a
TraversableNodeInterface
or aNodeAccessor
was discarded: #3861There is just a lot of overhead having to deal possibly with two abstractions in EEL helpers and its hard to stay consistent.
introduce EEL helpers to fetch the information by
Node
While EEL helpers can solve the technical problem of getting a
NodeType
or label for a Node the code is rather verbose and not as easily to remember than to just check which properties anode
has.Additionally the complexity increases when the variable is possible null and cannot be passed to an helper without risking a type error:
vs
introduce custom read model layer for eel
As only partially drafted out here neos/flow-development-collection#3153 and discussed in slack we could add a global special translation layer when Nodes are encountered. That will make it possible to add virtual properties accessible like
node.nodeType
andnode.label
without the corresponding implementation in the actual php model.For the current user-base it will be easy (because the will now wonder why this works) but new users might not be able to easily understand what is accessible on a node. By providing a
__dir
utility which transparently debugs accessible properties we could circumvent this (optional).summary
It often comes back to that we dont want to design the cr core so it will be best usable in EEL according to
ObjectAccess
. We need a way to influence and improve this.The text was updated successfully, but these errors were encountered: