Skip to content

Commit

Permalink
TASK: Remove "internal" node properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Apr 12, 2024
1 parent 02d325b commit ae11045
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/ContentRepository90/Rules/FusionNodeContextPathRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public function refactorFileContent(string $fileContent): string
'// TODO 9.0 migration: Line %LINE: !! You very likely need to rewrite "VARIABLE.contextPath" to "Neos.Node.serializedNodeAddress(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
)
->process(fn(string $eelExpression) => preg_replace(
'/(node|documentNode|site)\.property\\(\'_contextPath\'\\)/',
'/(node|documentNode|site)\.property\\((\'|")_contextPath(\'|")\\)/',
'Neos.Node.serializedNodeAddress($1)',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.property\\(\'_contextPath\'\\)/',
'/\.property\\((\'|")_contextPath(\'|")\\)/',
'// TODO 9.0 migration: Line %LINE: !! You very likely need to rewrite "VARIABLE.property(\'_contextPath\')" to "Neos.Node.serializedNodeAddress(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
)
->getProcessedContent();
Expand Down
4 changes: 2 additions & 2 deletions src/ContentRepository90/Rules/FusionNodeDepthRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public function refactorFileContent(string $fileContent): string
'// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.depth" to Neos.Node.depth(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
)
->process(fn(string $eelExpression) => preg_replace(
'/([a-zA-Z.]+)?(node|documentNode)\.property\\(\'_depth\'\\)/',
'/([a-zA-Z.]+)?(node|documentNode)\.property\\((\'|")_depth(\'|")\\)/',
'Neos.Node.depth($1$2)',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.property\\(\'_depth\'\\)/',
'/\.property\\((\'|")_depth(\'|")\\)/',
'// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.property(\'_depth\')" to Neos.Node.depth(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
)->getProcessedContent();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Fie
#
# pass down props
#
attributes = ${node.contextPath || documentNode.contextPath}
attributes = ${node.contextPath || documentNode.contextPath || node.property('_contextPath') || documentNode.property("_contextPath")}
foo = ${bar.property('_contextPath') || bar.property("_contextPath")}

#
# the `checked` state is calculated outside the renderer to allow` overriding via `attributes`
Expand All @@ -30,15 +31,17 @@ prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Fie
}
}
-----
// TODO 9.0 migration: Line 26: !! You very likely need to rewrite "VARIABLE.contextPath" to "Neos.Node.serializedNodeAddress(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.
// TODO 9.0 migration: Line 11: !! You very likely need to rewrite "VARIABLE.property('_contextPath')" to "Neos.Node.serializedNodeAddress(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.
// TODO 9.0 migration: Line 27: !! You very likely need to rewrite "VARIABLE.contextPath" to "Neos.Node.serializedNodeAddress(VARIABLE)". 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 = ${Neos.Node.serializedNodeAddress(node) || Neos.Node.serializedNodeAddress(documentNode)}
attributes = ${Neos.Node.serializedNodeAddress(node) || Neos.Node.serializedNodeAddress(documentNode) || Neos.Node.serializedNodeAddress(node) || Neos.Node.serializedNodeAddress(documentNode)}
foo = ${bar.property('_contextPath') || bar.property("_contextPath")}

#
# the `checked` state is calculated outside the renderer to allow` overriding via `attributes`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Fie
#
# pass down props
#
attributes = ${node.depth || documentNode.depth}
attributes = ${node.depth || documentNode.depth || node.property('_depth') || documentNode.property("_depth")}
foo = ${bar.property('_depth') || bar.property("_depth")}

#
# the `checked` state is calculated outside the renderer to allow` overriding via `attributes`
Expand All @@ -30,15 +31,17 @@ prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Fie
}
}
-----
// TODO 9.0 migration: Line 26: You may need to rewrite "VARIABLE.depth" to Neos.Node.depth(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node.
// TODO 9.0 migration: Line 11: You may need to rewrite "VARIABLE.property('_depth')" to Neos.Node.depth(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node.
// TODO 9.0 migration: Line 27: You may need to rewrite "VARIABLE.depth" to Neos.Node.depth(VARIABLE). 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 = ${Neos.Node.depth(node) || Neos.Node.depth(documentNode)}
attributes = ${Neos.Node.depth(node) || Neos.Node.depth(documentNode) || Neos.Node.depth(node) || Neos.Node.depth(documentNode)}
foo = ${bar.property('_depth') || bar.property("_depth")}

#
# the `checked` state is calculated outside the renderer to allow` overriding via `attributes`
Expand Down

0 comments on commit ae11045

Please sign in to comment.