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

Migrate Node::getNodeType #57

Open
mhsdesign opened this issue May 3, 2024 · 2 comments
Open

Migrate Node::getNodeType #57

mhsdesign opened this issue May 3, 2024 · 2 comments

Comments

@mhsdesign
Copy link
Member

mhsdesign commented May 3, 2024

neos/neos-development-collection#5020

Following code should be migrated:

- $node->getNodeTypeName();
+ $node->nodeTypeName;
- $node->getNodeType()->getName();
+ $node->nodeTypeName->value;
- $nodeType->getName();
+ $nodeType->name->value;
- $node->getNodeType();
+ $nodeTypeManger = ...;
+ $nodeTypeManager->getNodeType($node->nodeTypeName);
- $node->getNodeType()->getTypeOfAutoCreatedChildNode(NodeName::fromString('name'));
+ $nodeTypeManager->getTypeOfTetheredNode($node->nodeTypeName, NodeName::fromString('name'));
@mhsdesign
Copy link
Member Author

@dlubitz i have the feeling that the migrations cant be possible as clean as suggested and will likely look like having an obsolete step in between (fetching the nodeType first)

- $node->getNodeType()->getName();
+ $nodeTypeManager->getNodeType($node->nodeTypeName)->name->value;
- $node->getNodeType()->getTypeOfAutoCreatedChildNode(NodeName::fromString('name'));
+ $nodeTypeManager->getTypeOfTetheredNode($nodeTypeManager->getNodeType($node->nodeTypeName)->name, NodeName::fromString('name'));

... or we can have a rector rule to normalize $nodeTypeManager->getNodeType($node->nodeTypeName)->name to $node->nodeTypeName 😂

@dlubitz
Copy link
Contributor

dlubitz commented May 6, 2024

neos/neos-development-collection#4906 (comment)

Todo these rector migration would need to be adjusted so they dont pass the $nodeType to the methods, but $nodeType->name:

  • NodeTypeGetAutoCreatedChildNodesRector
  • NodeTypeGetTypeOfAutoCreatedChildNodeRector
  • NodeTypeAllowsGrandchildNodeTypeRector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants