final class CreateRootNodeAggregateWithNode implements CommandInterface, JsonSerializable, RebasableToOtherWorkspaceInterface (View source)

Create root node aggregate with node command

A root node has no variants and no origin dimension space point but occupies the whole allowed dimension subspace. It also has no tethered child nodes.

Methods

create(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeTypeName $nodeTypeName)

No description

withTetheredDescendantNodeAggregateIds(NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds)

Specify explicitly the node aggregate ids for the tethered children {tetheredDescendantNodeAggregateIds}.

fromArray(array $array)

No description

array
jsonSerialize()

No description

Details

static CreateRootNodeAggregateWithNode create(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeTypeName $nodeTypeName)

No description

Parameters

WorkspaceName $workspaceName

The workspace in which the root node should be created in

NodeAggregateId $nodeAggregateId

The id of the root node aggregate to create

NodeTypeName $nodeTypeName

Name of type of the new node to create

Return Value

CreateRootNodeAggregateWithNode

CreateRootNodeAggregateWithNode withTetheredDescendantNodeAggregateIds(NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds)

Specify explicitly the node aggregate ids for the tethered children {tetheredDescendantNodeAggregateIds}.

In case you want to create a batch of commands where one creates the root node and a succeeding command needs a tethered node aggregate id, you need to generate the child node aggregate ids in advance.

Alternatively you would need to fetch the created tethered node first from the subgraph. {\Neos\ContentRepository\Core\Feature\RootNodeCreation\Command\ContentSubgraphInterface::findNodeByPath()}

The helper method {\Neos\ContentRepository\Core\Feature\NodeCreation\Dto\NodeAggregateIdsByNodePaths::createForNodeType()} will generate recursively node aggregate ids for every tethered child node:

$tetheredDescendantNodeAggregateIds = NodeAggregateIdsByNodePaths::createForNodeType(
    $command->nodeTypeName,
    $nodeTypeManager
);
$command = $command->withTetheredDescendantNodeAggregateIds($tetheredDescendantNodeAggregateIds):

The generated node aggregate id for the tethered node "main" is this way known before the command is issued:

$mainNodeAggregateId = $command->tetheredDescendantNodeAggregateIds->getNodeAggregateId(NodePath::fromString('main'));

Generating the node aggregate ids from user land is totally optional.

Parameters

NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds

Return Value

CreateRootNodeAggregateWithNode

static CommandInterface fromArray(array $array)

No description

Parameters

array $array

Return Value

CommandInterface

array jsonSerialize()

No description

Return Value

array

RebasableToOtherWorkspaceInterface createCopyForWorkspace(WorkspaceName $targetWorkspaceName)

No description

Parameters

WorkspaceName $targetWorkspaceName

Return Value

RebasableToOtherWorkspaceInterface