Skip to content

Commit

Permalink
fix remaining nodeAggregateIdentifier -> nodeAggregateId
Browse files Browse the repository at this point in the history
  • Loading branch information
skurfuerst committed Mar 18, 2023
1 parent 9c22afe commit a7ab78f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions Classes/ContentRepository/Service/WorkspaceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,22 @@ public function getPublishableNodeInfo(WorkspaceName $workspaceName, ContentRepo
return [];
}
$changeFinder = $contentRepository->projectionState(ChangeFinder::class);
$changes = $changeFinder->findByContentStreamIdentifier($workspace->currentContentStreamId);
$changes = $changeFinder->findByContentStreamId($workspace->currentContentStreamId);
$unpublishedNodes = [];
foreach ($changes as $change) {
if ($change->removalAttachmentPoint) {
$nodeAddress = new NodeAddress(
$change->contentStreamIdentifier,
$change->contentStreamId,
$change->originDimensionSpacePoint->toDimensionSpacePoint(),
$change->nodeAggregateIdentifier,
$change->nodeAggregateId,
$workspaceName
);

/**
* See {@see Remove::apply} -> Removal Attachment Point == closest document node.
*/
$documentNodeAddress = new NodeAddress(
$change->contentStreamIdentifier,
$change->contentStreamId,
$change->originDimensionSpacePoint->toDimensionSpacePoint(),
$change->removalAttachmentPoint,
$workspaceName
Expand All @@ -95,7 +95,7 @@ public function getPublishableNodeInfo(WorkspaceName $workspaceName, ContentRepo
$change->originDimensionSpacePoint->toDimensionSpacePoint(),
VisibilityConstraints::withoutRestrictions()
);
$node = $subgraph->findNodeById($change->nodeAggregateIdentifier);
$node = $subgraph->findNodeById($change->nodeAggregateId);

if ($node instanceof Node) {
$documentNode = $this->getClosestDocumentNode($node);
Expand Down
10 changes: 5 additions & 5 deletions Classes/Domain/Model/Changes/AbstractCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ public function getName(): ?string

/**
* @param Node $parentNode
* @param NodeAggregateId|null $succeedingSiblingNodeAggregateIdentifier
* @param NodeAggregateId|null $succeedingSiblingNodeAggregateId
* @return Node
* @throws InvalidNodeCreationHandlerException|NodeNameIsAlreadyOccupied|NodeException
*/
protected function createNode(
Node $parentNode,
NodeAggregateId $succeedingSiblingNodeAggregateIdentifier = null
NodeAggregateId $succeedingSiblingNodeAggregateId = null
): Node {
$nodeTypeName = $this->getNodeTypeName();
if (is_null($nodeTypeName)) {
Expand All @@ -100,15 +100,15 @@ protected function createNode(
// $name = $this->getName() ?: $this->nodeService->generateUniqueNodeName($parent->findParentNode());
$nodeName = NodeName::fromString($this->getName() ?: uniqid('node-', false));

$nodeAggregateIdentifier = NodeAggregateId::create(); // generate a new NodeAggregateIdentifier
$nodeAggregateId = NodeAggregateId::create(); // generate a new NodeAggregateId

$command = new CreateNodeAggregateWithNode(
$parentNode->subgraphIdentity->contentStreamId,
$nodeAggregateIdentifier,
$nodeAggregateId,
$nodeTypeName,
OriginDimensionSpacePoint::fromDimensionSpacePoint($parentNode->subgraphIdentity->dimensionSpacePoint),
$parentNode->nodeAggregateId,
$succeedingSiblingNodeAggregateIdentifier,
$succeedingSiblingNodeAggregateId,
$nodeName
);
$contentRepository = $this->contentRepositoryRegistry->get($parentNode->subgraphIdentity->contentRepositoryId);
Expand Down
16 changes: 8 additions & 8 deletions Classes/Domain/Model/Changes/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,19 @@ public function apply(): void
// Use extra commands for reference handling
if ($propertyType === 'reference' || $propertyType === 'references') {
$value = $this->getValue();
$destinationNodeAggregateIdentifiers = [];
$destinationNodeAggregateIds = [];
if ($propertyType === 'reference') {
if (is_string($value) && !empty($value)) {
$destinationNodeAggregateIdentifiers[] = $value;
$destinationNodeAggregateIds[] = $value;
}
}

if ($propertyType === 'references') {
/** @var array<int,string> $values */
$values = $value;
if (is_array($values)) {
foreach ($values as $singleNodeAggregateIdentifier) {
$destinationNodeAggregateIdentifiers[] = $singleNodeAggregateIdentifier;
foreach ($values as $singleNodeAggregateId) {
$destinationNodeAggregateIds[] = $singleNodeAggregateId;
}
}
}
Expand All @@ -175,7 +175,7 @@ public function apply(): void
$subject->nodeAggregateId,
$subject->originDimensionSpacePoint,
ReferenceName::fromString($propertyName),
NodeReferencesToWrite::fromNodeAggregateIds(NodeAggregateIds::fromArray($destinationNodeAggregateIdentifiers))
NodeReferencesToWrite::fromNodeAggregateIds(NodeAggregateIds::fromArray($destinationNodeAggregateIds))
)
);
} else {
Expand Down Expand Up @@ -256,11 +256,11 @@ public function apply(): void
// because it may have been modified by the commands above.
// Thus, we need to re-fetch it (as a workaround; until we do not need this anymore)
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($subject);
$originalNodeAggregateIdentifier = $subject->nodeAggregateId;
$node = $subgraph->findNodeById($originalNodeAggregateIdentifier);
$originalNodeAggregateId = $subject->nodeAggregateId;
$node = $subgraph->findNodeById($originalNodeAggregateId);
if (is_null($node)) {
throw new \InvalidArgumentException(
'Cannot apply Property on missing node ' . $originalNodeAggregateIdentifier,
'Cannot apply Property on missing node ' . $originalNodeAggregateId,
1645560836
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private function flattenSubtreeToNodeList(
return;
}
$nodes[(string)$currentNode->getNodeAggregateIdentifier()] = $currentNode;
$nodes[(string)$currentNode->getNodeAggregateId()] = $currentNode;
foreach ($subtree->getChildren() as $childSubtree) {
$this->flattenSubtreeToNodeList($nodeAccessor, $childSubtree, $nodes);
Expand Down

0 comments on commit a7ab78f

Please sign in to comment.