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

BUGFIX: Build URI path based on parent from "target" dimensionSpacePoint #5091

Open
wants to merge 1 commit into
base: 9.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public function withOriginDimensionSpacePoint(OriginDimensionSpacePoint $originD
return new self($source);
}

public function withUriPath(string $uriPath): self
{
$source = $this->source;
$source['uripath'] = $uriPath;

return new self($source);
}

public function withoutSiblings(): self
{
$source = $this->source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,21 @@ private function copyVariants(
->withOriginDimensionSpacePoint($targetOrigin)
->withoutSiblings();

// check the parent in the "target" dimensionSpacePoint for the "URI prefix",
// may be different, see neos/neos-development-collection#5090
$parentNode = $this->tryGetNode(fn () => $this->getState()->getByIdAndDimensionSpacePointHash(
$sourceNode->getParentNodeAggregateId(),
$interdimensionalSibling->dimensionSpacePoint->hash
));
if ($parentNode !== null) {
$uriPathSegment = basename($sourceNode->getUriPath());
$uriPath = $parentNode->getUriPath() === ''
? $uriPathSegment
: $parentNode->getUriPath() . '/' . $uriPathSegment;
Comment on lines +455 to +458
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how we "calculate" the uri path in other places, but I don't remember having used basename() (not that I dislike it, but IMO it should be unified – potentially centralized to some DocumentNodeInfo::withUriPathSegment(string $newSegment)!?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, withUriPathSegment(…) does not help here, the basename(…) is used to get the segment I would need to pass here.

But I will get rid of basename and use code like in whenNodePropertiesWereSet(…) later in the class.


$targetNode = $targetNode->withUriPath($uriPath);
}

$this->insertNode($targetNode->toArray());
$this->connectNodeWithSiblings($targetNode, $targetNode->getParentNodeAggregateId(), $interdimensionalSibling->nodeAggregateId);
}
Expand Down
Loading