Skip to content

Commit

Permalink
Merge pull request #88 from neos/task/remove-value
Browse files Browse the repository at this point in the history
TASK: Remove .value in Fusion migrations
  • Loading branch information
mhsdesign authored Oct 18, 2024
2 parents caee8e5 + 9824a7d commit db21963
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/set/contentrepository-90.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
// setName
// getName
$methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getName', 'nodeName');
$fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_name', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_name")" to "VARIABLE.nodeName.value". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.');
$fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_name', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_name")" to "VARIABLE.nodeName". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.');
// getLabel
$rectorConfig->rule(FusionNodeLabelRector::class);
// setProperty
Expand Down
6 changes: 3 additions & 3 deletions src/ContentRepository90/Rules/FusionNodeTypeNameRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ class FusionNodeTypeNameRector implements FusionRectorInterface

public function getRuleDefinition(): RuleDefinition
{
return CodeSampleLoader::fromFile('Fusion: Rewrite node.nodeType.name to node.nodeTypeName.value', __CLASS__);
return CodeSampleLoader::fromFile('Fusion: Rewrite node.nodeType.name to node.nodeTypeName', __CLASS__);
}

public function refactorFileContent(string $fileContent): string
{
return EelExpressionTransformer::parse($fileContent)
->process(fn(string $eelExpression) => preg_replace(
'/(node|documentNode|site)\.nodeType\.name/',
'$1.nodeTypeName.value',
'$1.nodeTypeName',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.nodeType.name/',
'// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.nodeType.name" to "VARIABLE.nodeTypeName.value". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
'// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.nodeType.name" to "VARIABLE.nodeTypeName". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
)->getProcessedContent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ renderer = afx`
}
}
-----
// TODO 9.0 migration: Line 13: You may need to rewrite "VARIABLE.nodeType.name" to "VARIABLE.nodeTypeName.value". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.
// TODO 9.0 migration: Line 13: You may need to rewrite "VARIABLE.nodeType.name" to "VARIABLE.nodeTypeName". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.
prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {

renderer = Neos.Fusion:Component {

#
# pass down props
#
attributes = ${node.nodeTypeName.value || documentNode.nodeTypeName.value}
attributes = ${node.nodeTypeName || documentNode.nodeTypeName}
renderer = afx`
<input
name={node.nodeTypeName.value}
name={node.nodeTypeName}
value={someOtherVariable.nodeType.name}
{...node.nodeTypeName.value}
{...node.nodeTypeName}
/>
`
}
Expand Down

0 comments on commit db21963

Please sign in to comment.