Skip to content
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
21 changes: 2 additions & 19 deletions Neos.ContentRepository/Classes/Domain/Model/Workspace.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ public function publishNode(NodeInterface $nodeToPublish, Workspace $targetWorks
}

$this->emitAfterNodePublishing($nodeToPublish, $targetWorkspace);
$this->nodeDataRepository->persistEntities();
}

/**
Expand Down Expand Up @@ -486,7 +487,7 @@ protected function replaceNodeData(NodeInterface $sourceNode, NodeData $targetNo
// At this point adjustShadowNodeDataForNodePublishing will not yield correct results as we cannot
// find the _original_ state in the target workspace anymore and have a shadow node in memory already if
// it was necessary. Therefore we will just delete any possibly existing shadow node in the source workspace.
$targetNodeData = $this->moveTargetNodeDataToNewPosition($targetNodeData, $sourceNode->getPath());
$targetNodeData = $targetNodeData->move($sourceNode->getPath(), $targetNodeData->getWorkspace());
$sourceShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($sourceNodeData);
if ($sourceShadowNodeData !== null) {
$this->nodeDataRepository->remove($sourceShadowNodeData);
Expand Down Expand Up @@ -545,24 +546,6 @@ protected function moveNodeVariantsInOtherWorkspaces($nodeIdentifier, $targetPat
}
}

/**
* Moves an existing node in a target workspace to the place it should be in after publish,
* in order to move all children to the new position as well.
*
* @param NodeData $targetNodeData The (publish-) target node data to be moved
* @param string $destinationPath The destination path of the move
* @return NodeData Either the same object like $targetNodeData, or, if $targetNodeData was transformed into a shadow node, the new target node (see move())
*/
protected function moveTargetNodeDataToNewPosition(NodeData $targetNodeData, $destinationPath)
{
if ($targetNodeData->getWorkspace()->getBaseWorkspace() === null) {
$targetNodeData->setPath($destinationPath);
return $targetNodeData;
}

return $targetNodeData->move($destinationPath, $targetNodeData->getWorkspace());
}

/**
* Move the given node instance to the target workspace
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,3 +487,25 @@ Feature: Move node
| live |
Then I should have one node

@fixtures
Scenario: Move a node and it's parent separately
Given I have the following nodes:
| Identifier | Path | Node Type | Properties | Workspace |
| 0990ad05-cce6-4241-af8f-f0c77cbd9583 | /sites/content-repository/company/history | Neos.ContentRepository.Testing:Page | {"title": "history"} | live |
And I get a node by path "/sites/content-repository/company/history" with the following context:
| Workspace |
| user-admin |
And I move the node into the node with path "/sites/content-repository/about"
When I get a node by path "/sites/content-repository/company" with the following context:
| Workspace |
| user-admin |
And I move the node into the node with path "/sites/content-repository/about"
And I publish the workspace "user-admin"
When I get a node by path "/sites/content-repository/about/history" with the following context:
| Workspace |
| live |
Then I should have one node
And I get a node by path "/sites/content-repository/about/company" with the following context:
| Workspace |
| live |
Then I should have one node
2 changes: 0 additions & 2 deletions Neos.Neos/Classes/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
use Neos\ContentRepository\Domain\Model\Node;
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\ContentRepository\Domain\Model\Workspace;
use Neos\ContentRepository\Domain\Repository\NodeDataRepository;
use Neos\ContentRepository\Domain\Service\Context;
use Neos\Fusion\Core\Cache\ContentCache;

Expand Down Expand Up @@ -147,6 +146,5 @@ public function boot(Bootstrap $bootstrap)
$dispatcher->connect(Workspace::class, 'baseWorkspaceChanged', RouteCacheFlusher::class, 'registerBaseWorkspaceChange');

$dispatcher->connect(PersistenceManager::class, 'allObjectsPersisted', ContentRepositoryIntegrationService::class, 'updateEventsAfterPublish');
$dispatcher->connect(NodeDataRepository::class, 'repositoryObjectsPersisted', ContentRepositoryIntegrationService::class, 'updateEventsAfterPublish');
}
}
Loading