Skip to content

Commit

Permalink
TASK: Deprecate targetNodeName in CopyNodesRecursively
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jun 30, 2024
1 parent 30e35d5 commit d8cc7a7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ public static function createFromSubgraphAndStartNode(
Node $startNode,
OriginDimensionSpacePoint $dimensionSpacePoint,
NodeAggregateId $targetParentNodeAggregateId,
?NodeAggregateId $targetSucceedingSiblingNodeAggregateId,
?NodeName $targetNodeName
?NodeAggregateId $targetSucceedingSiblingNodeAggregateId
): self {
$nodeSubtreeSnapshot = NodeSubtreeSnapshot::fromSubgraphAndStartNode($subgraph, $startNode);

Expand All @@ -96,7 +95,7 @@ public static function createFromSubgraphAndStartNode(
$dimensionSpacePoint,
$targetParentNodeAggregateId,
$targetSucceedingSiblingNodeAggregateId,
$targetNodeName,
null,
NodeAggregateIdMapping::generateForNodeSubtreeSnapshot($nodeSubtreeSnapshot)
);
}
Expand Down Expand Up @@ -153,34 +152,34 @@ public function withNodeAggregateIdMapping(
);
}

public function createCopyForWorkspace(
WorkspaceName $targetWorkspaceName,
): self {
/**
* The target node's optional name.
*
* @deprecated the concept regarding node-names for non-tethered nodes is outdated.
*/
public function withTargetNodeName(NodeName $targetNodeName): self
{
return new self(
$targetWorkspaceName,
$this->workspaceName,
$this->nodeTreeToInsert,
$this->targetDimensionSpacePoint,
$this->targetParentNodeAggregateId,
$this->targetSucceedingSiblingNodeAggregateId,
$this->targetNodeName,
$targetNodeName,
$this->nodeAggregateIdMapping
);
}

/**
* The target node's optional name.
*
* @deprecated the concept regarding node-names for non-tethered nodes is outdated.
*/
public function withNodeName(NodeName $nodeName): self
{
public function createCopyForWorkspace(
WorkspaceName $targetWorkspaceName,
): self {
return new self(
$this->workspaceName,
$targetWorkspaceName,
$this->nodeTreeToInsert,
$this->targetDimensionSpacePoint,
$this->targetParentNodeAggregateId,
$this->targetSucceedingSiblingNodeAggregateId,
$nodeName,
$this->targetNodeName,
$this->nodeAggregateIdMapping
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ public function theCommandCopyNodesRecursivelyIsExecutedCopyingTheCurrentNodeAgg
$targetSucceedingSiblingNodeAggregateId = isset($commandArguments['targetSucceedingSiblingNodeAggregateId'])
? NodeAggregateId::fromString($commandArguments['targetSucceedingSiblingNodeAggregateId'])
: null;
$targetNodeName = isset($commandArguments['targetNodeName'])
? NodeName::fromString($commandArguments['targetNodeName'])
: null;

$workspaceName = isset($commandArguments['workspaceName'])
? WorkspaceName::fromString($commandArguments['workspaceName'])
: $this->currentWorkspaceName;
Expand All @@ -62,9 +60,11 @@ public function theCommandCopyNodesRecursivelyIsExecutedCopyingTheCurrentNodeAgg
$this->currentNode,
$targetDimensionSpacePoint,
NodeAggregateId::fromString($commandArguments['targetParentNodeAggregateId']),
$targetSucceedingSiblingNodeAggregateId,
$targetNodeName
$targetSucceedingSiblingNodeAggregateId
);
if (isset($commandArguments['targetNodeName'])) {
$command = $command->withTargetNodeName(NodeName::fromString($commandArguments['targetNodeName']));
}
$command = $command->withNodeAggregateIdMapping(NodeAggregateIdMapping::fromArray($commandArguments['nodeAggregateIdMapping']));

$this->currentContentRepository->handle($command);
Expand Down

0 comments on commit d8cc7a7

Please sign in to comment.