-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
BUGFIX: Handle nodes with missing UriPathSegments in uriPathProjection #5412
base: 9.0
Are you sure you want to change the base?
BUGFIX: Handle nodes with missing UriPathSegments in uriPathProjection #5412
Conversation
Since "" is treated as the uriPath for a site node this causes confusion if it is projected for a document in cases where one was created without an uriPathSegment which may happen for tethered nodes. Resolves: neos#5412
43fdcb5
to
107b282
Compare
…gments The testcase verifies that the nodeAggregateId is used as fallback in case no uriPathSegment was set and that this can be overwritten afterwards of a proper uriPathSegment is set later. Relates: neos#5413
Since "" is treated as the uriPath for a site node this causes confusion if it is projected for a document in cases where one was created without an uriPathSegment which may happen for tethered nodes. Resolves: neos#5412
107b282
to
dd3ff9d
Compare
a16aeb8
to
d81eb9f
Compare
I wonder wether the site node detection that is currently done in handCreateNodeAggregateWith is wise because a |
9abce68
to
d9772d3
Compare
Since "" is treated as the uriPath for a site node this causes confusion if it is projected for a document in cases where one was created without an uriPathSegment which may happen for tethered nodes. Resolves: neos#5412
…vior The projection detects site nodes that should have an empty path by verifying that the parent is a root node and they have a nodeName.
d9772d3
to
64d52a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand, why some seemingly unrelated tests needed adjustments, but the change itself makes sense to me, thanks!
The definition of site node (with path „“) used in the uriPathProjection is that it is a child of a rootNode and has a nodeName. The adjusted tests only worked in the past because an empty uriPathSegment was treated implicitly like a site node. Since we now have fallback for empty uriPathSegments the tests that relied on that now need a proper site Node. |
@@ -209,7 +209,7 @@ private function whenNodeAggregateWithNodeWasCreated(NodeAggregateWithNodeWasCre | |||
} | |||
|
|||
$propertyValues = $event->initialPropertyValues->getPlainValues(); | |||
$uriPathSegment = $propertyValues['uriPathSegment'] ?? ''; | |||
$uriPathSegment = $propertyValues['uriPathSegment'] ?? $event->nodeAggregateId->value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we discussed an alternative in line 273 but it doesnt really work :D
$uriPath = $this->nodeTypeManager->getNodeType($parentNode->getNodeTypeName())?->isOfType(NodeTypeNameFactory::NAME_SITE)
? $uriPathSegment
: $parentNode->getUriPath() . '/' . $uriPathSegment;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still think resilience against missing uri path segments is better than adding an even tighter bond to the Neos NodeTypes. Even if this would work ;-)
The fallback way makes uriPathes more like a soft concern (which it is technically anyways) and allows routing of documents in cases where it is missing for any reason.
Only thing that would speak against that would be a case where the node-identifier based fallback does harm anything but i do not see a way for this to happen.
Use nodeAggregateId as fallback for missing uriPathSegments in uriPathProjection.
This is necessary as the fallback to "" can create empty pathes for documents without uriPathSegment which is later on confused with root urls of the site. Falling back to the nodeAggregate id which is by definition unique and url-safe ensures that all documents get a valid url by the projection that can be adjusted later.
Empty uriPathSegments are usually avoided by validation and autocreation from the title but those mechanisms do not work for tethered nodes. This is even more problematic as this cannot be fixed later since the full uriPath is only created oCreate and laster on only the last segment of the path is adjusted without ever reevaluating the parentPath.
In addition this pr adds a nodeName to the site node in multiple test cases as this is actually required and only worked in the past because the empty uriPathSegment behaved like a site node.
Resolves: #5413
Upgrade instructions
Review instructions
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions