CreateRootNodeAggregateWithNode
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
No description
Specify explicitly the node aggregate ids for the tethered children {tetheredDescendantNodeAggregateIds}.
No description
No description
Details
static CreateRootNodeAggregateWithNode
create(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeTypeName $nodeTypeName)
No description
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.
static CommandInterface
fromArray(array $array)
No description
array
jsonSerialize()
No description
RebasableToOtherWorkspaceInterface
createCopyForWorkspace(WorkspaceName $targetWorkspaceName)
No description