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: Remove Node::nodeType #5021

Open
wants to merge 3 commits into
base: 9.0
Choose a base branch
from

Conversation

mhsdesign
Copy link
Member

@mhsdesign mhsdesign commented Apr 30, 2024

Requires #5020 in the long term.

With #4466 the fallback NodeType handling was removed from the core NodeType manager and extracted to Neos. See the trait NodeTypeWithFallbackProvider.
That required to make the nodeType field nullable on the NodeType.

This pr takes it a bit further by fully removing the attached NodeType schema from the Node.

Resolves partially #5019

Upgrade instructions

To get the NodeType for a Node in PHP, one can either use the Node::nodeTypeName and ask the Neos\ContentRepository\Core\NodeType\NodeTypeManager::getNodeType:

+ $nodeTypeManager->getNodeType($node->nodeTypeName);
- $node->nodeType;

Or for the Neos use-case the Neos\Neos\Utility\NodeTypeWithFallbackProvider trait can be used, which will return a NodeType instance for any Node considering the Fallback (Neos.Neos:FallbackNode) in case the NodeType was removed:

+ #[Flow\Inject]
+ protected ContentRepositoryRegistry $contentRepositoryRegistry;
+
+ use NodeTypeWithFallbackProvider;
+
+ $this->getNodeType($node);
- $node->nodeType;

In Fusion accessing the NodeType via ${node.nodeType} will currently no longer work (a translation layer is in conception: #5022) but one can leverage the helper ${Neos.Node.getNodeType(node)} to access the NodeType.

Review instructions

Followup node.nodeType viewhelper for fluid (see also #5023)
Rector migrations will be provided as part of neos/rector#57

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

@github-actions github-actions bot added the 9.0 label Apr 30, 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.

This is great, thanks for taking care!

But since this is a breaking change that will affect most installations, we should make sure that we have

  • A proper description with explanations on how to migrate code
  • Rector migration for Fusion code
  • Rector migration for PHP code

And IMO we should have those in place before we merge this one – at least the first one :)

The `NodeTypeManager` must be asked instead.
For Neos' fallback logic the `NodeTypeWithFallbackProvider` can be used.
@mhsdesign mhsdesign force-pushed the task/5019-remove-nodetype-from-node branch from a2f9300 to 437f842 Compare May 15, 2024 16:23
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.

None yet

2 participants