Skip to content

Commit

Permalink
TASK: Adjust controllers to use legacy node address notation explicit…
Browse files Browse the repository at this point in the history
…ly instead of property mapping
  • Loading branch information
mhsdesign committed Jun 16, 2024
1 parent 1733e89 commit 368739e
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions Classes/Controller/WorkspaceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,13 @@ public function deleteAction(WorkspaceName $workspaceName): void
* Rebase the current users personal workspace onto the given $targetWorkspace and then
* redirects to the $targetNode in the content module.
*/
public function rebaseAndRedirectAction(Node $targetNode, Workspace $targetWorkspace): void
public function rebaseAndRedirectAction(string $targetNode, Workspace $targetWorkspace): void
{
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())
->contentRepositoryId;
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
// todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress
$targetNodeAddress = NodeAddressFactory::create($contentRepository)->createCoreNodeAddressFromLegacyUriString($targetNode);

/** @var ?Account $currentAccount */
$currentAccount = $this->securityContext->getAccount();
Expand Down Expand Up @@ -482,10 +484,10 @@ public function rebaseAndRedirectAction(Node $targetNode, Workspace $targetWorks
*/

$targetNodeAddressInPersonalWorkspace = NodeAddress::create(
$targetNode->contentRepositoryId,
$targetNodeAddress->contentRepositoryId,
$personalWorkspace->workspaceName,
$targetNode->dimensionSpacePoint,
$targetNode->aggregateId
$targetNodeAddress->dimensionSpacePoint,
$targetNodeAddress->aggregateId
);

if ($this->packageManager->isPackageAvailable('Neos.Neos.Ui')) {
Expand Down Expand Up @@ -526,13 +528,14 @@ public function publishNodeAction(string $nodeAddress, WorkspaceName $selectedWo
->contentRepositoryId;
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
$nodeAddressFactory = NodeAddressFactory::create($contentRepository);
$nodeAddress = $nodeAddressFactory->createFromUriString($nodeAddress);
// todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress
$nodeAddress = $nodeAddressFactory->createCoreNodeAddressFromLegacyUriString($nodeAddress);

$command = PublishIndividualNodesFromWorkspace::create(
$selectedWorkspace,
NodeIdsToPublishOrDiscard::create(
new NodeIdToPublishOrDiscard(
$nodeAddress->nodeAggregateId,
$nodeAddress->aggregateId,
$nodeAddress->dimensionSpacePoint
)
),
Expand Down Expand Up @@ -563,13 +566,14 @@ public function discardNodeAction(string $nodeAddress, WorkspaceName $selectedWo
->contentRepositoryId;
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
$nodeAddressFactory = NodeAddressFactory::create($contentRepository);
$nodeAddress = $nodeAddressFactory->createFromUriString($nodeAddress);
// todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress
$nodeAddress = $nodeAddressFactory->createCoreNodeAddressFromLegacyUriString($nodeAddress);

$command = DiscardIndividualNodesFromWorkspace::create(
$selectedWorkspace,
NodeIdsToPublishOrDiscard::create(
new NodeIdToPublishOrDiscard(
$nodeAddress->nodeAggregateId,
$nodeAddress->aggregateId,
$nodeAddress->dimensionSpacePoint
)
),
Expand Down Expand Up @@ -604,9 +608,10 @@ public function publishOrDiscardNodesAction(array $nodes, string $action, string

$nodesToPublishOrDiscard = [];
foreach ($nodes as $node) {
$nodeAddress = $nodeAddressFactory->createFromUriString($node);
// todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress
$nodeAddress = $nodeAddressFactory->createCoreNodeAddressFromLegacyUriString($node);
$nodesToPublishOrDiscard[] = new NodeIdToPublishOrDiscard(
$nodeAddress->nodeAggregateId,
$nodeAddress->aggregateId,
$nodeAddress->dimensionSpacePoint
);
}
Expand Down

0 comments on commit 368739e

Please sign in to comment.