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

TASK Deprecate overhauled temporary FlowQueries and use node field access instead #5277

Merged

Conversation

mhsdesign
Copy link
Member

@mhsdesign mhsdesign commented Oct 8, 2024

with #5241 value object were made string-able, so they are simply usable in fusion after all.

Previously flowquery operations were introduced to not have to do the manual string cast via .value in node.nodeTypeName.value and similar.

The label flowquery operation was introduced in the same run but now we reconsidered that flowquery should mostly be used for traversal and the only real final operation is get().

For this reason we also discourage the property operation now. The negative performance aspect of 8.3 of needlesly resolving all reference nodes by calling node.properties.title is dated as now only real properties are ever in the result set.

Upgrade instructions

Review instructions

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

…query operations

with neos#5241 value object were made string-able, so they are simply usable in fusion after all.

Previously flowquery operations were introduced to not have to do the manual string cast via `.value` in `node.nodeTypeName.value` and similar.

The label flowquery operation was introduced in the same run but now we reconsidered that flowquery should mostly be used for traversal and the only real final operation is get().

For this reason we also discourage the property operation now. The negative performance aspect of 8.3 of needlesly resolving all reference nodes by calling `node.properties.title` is dated as now only real properties are ever in the result set.
@github-actions github-actions bot added the 9.0 label Oct 8, 2024
@mhsdesign mhsdesign changed the title TASK Prefer node field access instead of flowquery TASK Deprecate overhauled temporary FlowQueries and use node field access instead Oct 8, 2024
Copy link
Member

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 by reading, thanks for taking care.

Just some comment regarding the deprecated Flow operations:
Will the @deprecated annotations in the PHP implementation really help to prevent developers/integrators from using them?
What is our phasing out strategy?

If we keep the @deprecated annotations, we should maybe add the version, i.e. @deprecated with 9.0.0-beta14...

@@ -21,6 +21,7 @@

/**
* Used to access the Node's identifier of a ContentRepository Node.
* @deprecated please use ${node.aggregateId} instead
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we deal with those deprecations – AFAIS the user won't notice them.
Wouldn't it make more sense to just remove the operation so they do?
Or what are the plans for a removal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha thing is this was praised by us to BE THE way in beta10 https://discuss.neos.io/t/neos-9-beta-10-release/6578 and beta11 again https://discuss.neos.io/t/neos-9-beta-11-release/6618 so i dont know if we can just remove them again 😅 . This is a classic EIGENTOR. And for what i think we dont need to remove i before the beta as a dead fq doesnt hurt.

/**
* Renders the actual node label based on the NodeType definition in Fusion.
*/
public function getLabel(Node $node): string
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be unlucky that the Neos.Node is also used as helper to generate the actual label in yaml. See NodeHelper::labelForNode above. Like:

'Vendor.Site:MyContent':
  label: "${Neos.Node.labelForNode(node).prefix('foo')}"

so its unfortunate that the naming is not distinct and one could easily create a recursion here. Though that was also possible in 8.3 by just writing label: "${node.label}"

As an outlook i would propose to deprecate Neos.Node for the yaml case at some point and then introduce a more specialised Label.createForNode helper or something that is only to be used in YAML. Having the capabilities to access the "NodeLabelToken" through fusion is not the desired usecase as far as i can tell.

Thats why i named the method getLabel in the first place and not just label as the ambiguity would be even bigger. Though Neos.Node.label(node) would fit better with the semantics Neos.Node.depth(node) and path so we have to decide on that!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separating the helper for YAML makes sense to me. I would probably start that transition ASAP by creating the new helper and leaving labelForNode here deprecated just calling the other one. And then really just using label(node) as method name for consistency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you want to unify them into one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to split them as they are separate usecases: f22d740

The labelForNode feature was 'just' introduced in #3328 and i consider it safe that it was not really used in fusion so i have no b/c layer in place.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well as its Neos.Neos.label i might have messed up the Neos.Node.getNodeType earlier so i created a sister pr #5287

Copy link
Member

@kitsunet kitsunet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See one comment otherwise this could go in.

Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good by reading and I love the change ❤️

@@ -422,7 +422,7 @@ Neos:
Json: Neos\Eel\Helper\JsonHelper
I18n: Neos\Flow\I18n\EelHelper\TranslationHelper
q: Neos\Eel\FlowQuery\FlowQuery::q
Neos.Node: Neos\Neos\Fusion\Helper\NodeHelper
Neos.Node: Neos\Neos\Fusion\Helper\NodeLabelHelper
Copy link
Member

@Sebobo Sebobo Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right to me, depending on the context, the same helper name are two different classes, that do similar stuff?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jup its to say a litte dirty at least. The NodeHelper contained in Neos 8.3 just 3 methods but in Neos 9 now a whole lot more (and also the label method which would lead to a recursion)
Alternatively we could introduce a new namespace like Neos.NodeLabel.labelForNode or labelForNode(node) as function, or NodeLabel.labelForNode while probably still keeping the proposed Neos.Node: Neos\Neos\Fusion\Helper\NodeLabelHelper as legacy layer.

But i thought its not really worth the effort. Thats why the documentation in NodeLabelHelper also explains its not the same as the other. Whats your idea.

Copy link
Member

@kitsunet kitsunet Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this is confusing as hell, please lets not do this. Also what if I want to actually use one of the Neos.Node functions in my label

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jup agreed. Hmm especially here:

${(Neos.Node.getNodeType(node).label || node.nodeTypeName.value) + (node.nodeName ? ' (' + node.nodeName.value + ')' : '')}

We actually need the node type in the yaml expression ...

so i guess there are two ways from here:

introduce a new NodeLabelHelper an register it under Neos.NodeLabel or something
keep the Neos.Node helper registered in yaml but deprecate its method labelForNode

Keep everything in NodeHelper and just rename labelForNode

3

Keep labelForNode and label side by side which is a little confusing but maybe okay?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we decided on 3

@mhsdesign mhsdesign merged commit 41de09a into neos:9.0 Oct 14, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants