Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/9.0' into task/deprecate-Disable…
Browse files Browse the repository at this point in the history
…NodeAggregate
  • Loading branch information
mhsdesign committed Mar 5, 2025
2 parents 45b0795 + 79671f9 commit d716269
Show file tree
Hide file tree
Showing 53 changed files with 690 additions and 209 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function findNodeAggregateById(
return $this->nodeFactory->mapNodeRowsToNodeAggregate(
$this->fetchRows($queryBuilder),
$this->workspaceName,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
}

Expand Down Expand Up @@ -274,7 +274,7 @@ public function findParentNodeAggregateByChildOriginDimensionSpacePoint(NodeAggr
return $this->nodeFactory->mapNodeRowsToNodeAggregate(
$this->fetchRows($queryBuilder),
$this->workspaceName,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
}

Expand Down Expand Up @@ -368,7 +368,7 @@ private function mapQueryBuilderToNodeAggregate(QueryBuilder $queryBuilder): ?No
return $this->nodeFactory->mapNodeRowsToNodeAggregate(
$this->fetchRows($queryBuilder),
$this->workspaceName,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
}

Expand All @@ -381,7 +381,7 @@ private function mapQueryBuilderToNodeAggregates(QueryBuilder $queryBuilder): No
return $this->nodeFactory->mapNodeRowsToNodeAggregates(
$this->fetchRows($queryBuilder),
$this->workspaceName,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ private function addSubtreeTagConstraints(QueryBuilder $queryBuilder, string $hi
{
$hierarchyRelationTablePrefix = $hierarchyRelationTableAlias === '' ? '' : $hierarchyRelationTableAlias . '.';
$i = 0;
foreach ($this->visibilityConstraints->tagConstraints as $excludedTag) {
foreach ($this->visibilityConstraints->excludedSubtreeTags as $excludedTag) {
$queryBuilder->andWhere('NOT JSON_CONTAINS_PATH(' . $hierarchyRelationTablePrefix . 'subtreetags, \'one\', :tagPath' . $i . ')')->setParameter('tagPath' . $i, '$.' . $excludedTag->value);
$i++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function findNodeAggregateById(

return $this->nodeFactory->mapNodeRowsToNodeAggregate(
$nodeRows,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
}

Expand Down Expand Up @@ -173,7 +173,7 @@ public function findParentNodeAggregateByChildOriginDimensionSpacePoint(

return $this->nodeFactory->mapNodeRowsToNodeAggregate(
$nodeRows,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
}

Expand All @@ -187,7 +187,7 @@ public function findParentNodeAggregates(

return $this->nodeFactory->mapNodeRowsToNodeAggregates(
$nodeRows,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
}

Expand Down Expand Up @@ -217,7 +217,7 @@ public function findChildNodeAggregates(

return $this->nodeFactory->mapNodeRowsToNodeAggregates(
$nodeRows,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
}

Expand All @@ -236,7 +236,7 @@ public function findChildNodeAggregateByName(

return $this->nodeFactory->mapNodeRowsToNodeAggregate(
$nodeRows,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
}

Expand All @@ -252,7 +252,7 @@ public function findTetheredChildNodeAggregates(

$nodeRows = $query->execute($this->dbal)->fetchAllAssociative();

return $this->nodeFactory->mapNodeRowsToNodeAggregates($nodeRows, VisibilityConstraints::withoutRestrictions());
return $this->nodeFactory->mapNodeRowsToNodeAggregates($nodeRows, VisibilityConstraints::createEmpty());
}

public function getDimensionSpacePointsOccupiedByChildNodeName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,3 @@ Feature: Remove NodeAggregate
| coveredDimensionSpacePoint | {"language": "en"} |
| nodeVariantSelectionStrategy | "allVariants" |
Then the last command should have thrown an exception of type "NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint"

Scenario: Try to remove a node aggregate using a non-existent removalAttachmentPoint
When the command RemoveNodeAggregate is executed with payload and exceptions are caught:
| Key | Value |
| nodeAggregateId | "sir-david-nodenborough" |
| nodeVariantSelectionStrategy | "allVariants" |
| coveredDimensionSpacePoint | {"language":"de"} |
| removalAttachmentPoint | "i-do-not-exist" |
Then the last command should have thrown an exception of type "NodeAggregateCurrentlyDoesNotExist"
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Feature: Remove NodeAggregate
| nodeAggregateId | "nodingers-cat" |
| affectedOccupiedDimensionSpacePoints | [[]] |
| affectedCoveredDimensionSpacePoints | [[]] |
| removalAttachmentPoint | null |
Then I expect the graph projection to consist of exactly 2 nodes
And I expect a node identified by cs-identifier;lady-eleonode-rootford;{} to exist in the content graph
And I expect a node identified by cs-identifier;sir-david-nodenborough;{} to exist in the content graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Feature: Remove NodeAggregate
| nodeAggregateId | "nodingers-cat" |
| affectedOccupiedDimensionSpacePoints | [{"language":"en"}] |
| affectedCoveredDimensionSpacePoints | [{"language":"de"},{"language":"gsw"}] |
| removalAttachmentPoint | null |
Then I expect the graph projection to consist of exactly 4 nodes
And I expect a node identified by cs-identifier;lady-eleonode-rootford;{} to exist in the content graph
And I expect a node identified by cs-identifier;sir-david-nodenborough;{"language":"en"} to exist in the content graph
Expand Down Expand Up @@ -198,7 +197,6 @@ Feature: Remove NodeAggregate
| nodeAggregateId | "nodingers-cat" |
| affectedOccupiedDimensionSpacePoints | [{"language":"de"},{"language":"en"}] |
| affectedCoveredDimensionSpacePoints | [{"language":"de"},{"language":"en"},{"language":"gsw"},{"language":"fr"}] |
| removalAttachmentPoint | null |
Then I expect the graph projection to consist of exactly 2 nodes
And I expect a node identified by cs-identifier;lady-eleonode-rootford;{} to exist in the content graph
And I expect a node identified by cs-identifier;sir-david-nodenborough;{"language":"en"} to exist in the content graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ Feature: Change node aggregate type - behavior of DELETE strategy
| nodeAggregateId | "nodingers-cat" |
| affectedOccupiedDimensionSpacePoints | [{"language":"de"},{"language":"gsw"}] |
| affectedCoveredDimensionSpacePoints | [{"language":"de"},{"language":"gsw"}] |
| removalAttachmentPoint | null |
And event at index 14 is of type "NodeAggregateTypeWasChanged" with payload:
| Key | Expected |
| workspaceName | "live" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function whileANodesArWrittenOnLive(): void
$this->log('1. writing finished');
Assert::assertTrue(true, 'No exception was thrown ;)');

$subgraph = $this->contentRepository->getContentGraph(WorkspaceName::forLive())->getSubgraph(DimensionSpacePoint::createWithoutDimensions(), VisibilityConstraints::withoutRestrictions());
$subgraph = $this->contentRepository->getContentGraph(WorkspaceName::forLive())->getSubgraph(DimensionSpacePoint::createWithoutDimensions(), VisibilityConstraints::createEmpty());
$node = $subgraph->findNodeById(NodeAggregateId::fromString('nody-mc-nodeface-100'));
Assert::assertNotNull($node);
}
Expand Down Expand Up @@ -220,7 +220,7 @@ public function thenConcurrentPublishLeadsToException(): void

Assert::assertTrue(true, 'No exception was thrown ;)');

$subgraph = $this->contentRepository->getContentGraph(WorkspaceName::fromString('user-test'))->getSubgraph(DimensionSpacePoint::createWithoutDimensions(), VisibilityConstraints::withoutRestrictions());
$subgraph = $this->contentRepository->getContentGraph(WorkspaceName::fromString('user-test'))->getSubgraph(DimensionSpacePoint::createWithoutDimensions(), VisibilityConstraints::createEmpty());
$node = $subgraph->findNodeById(NodeAggregateId::fromString('user-nody-mc-nodeface-100'));
Assert::assertNotNull($node);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function whileANodesArWrittenOnLive(): void
$this->log('writing finished');
Assert::assertTrue(true, 'No exception was thrown ;)');

$subgraph = $this->contentRepository->getContentGraph(WorkspaceName::forLive())->getSubgraph(DimensionSpacePoint::createWithoutDimensions(), VisibilityConstraints::withoutRestrictions());
$subgraph = $this->contentRepository->getContentGraph(WorkspaceName::forLive())->getSubgraph(DimensionSpacePoint::createWithoutDimensions(), VisibilityConstraints::createEmpty());
$node = $subgraph->findNodeById(NodeAggregateId::fromString('nody-mc-nodeface'));
Assert::assertNotNull($node);
Assert::assertSame($node->getProperty('title'), 'changed-title-50');
Expand Down Expand Up @@ -253,7 +253,7 @@ public function thenConcurrentPublishLeadsToException(): void
}

$node = $this->contentRepository->getContentGraph(WorkspaceName::fromString('user-test'))
->getSubgraph(DimensionSpacePoint::createWithoutDimensions(), VisibilityConstraints::withoutRestrictions())
->getSubgraph(DimensionSpacePoint::createWithoutDimensions(), VisibilityConstraints::createEmpty())
->findNodeById(NodeAggregateId::fromString('nody-mc-nodeface'));

Assert::assertSame('written-after-failed-publish', $node?->getProperty('title'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function thenConcurrentCommandsLeadToAnException(): void
$this->log('write finished');

$node = $this->contentRepository->getContentGraph(WorkspaceName::fromString('user-test'))
->getSubgraph(DimensionSpacePoint::createWithoutDimensions(), VisibilityConstraints::withoutRestrictions())
->getSubgraph(DimensionSpacePoint::createWithoutDimensions(), VisibilityConstraints::createEmpty())
->findNodeById(NodeAggregateId::fromString('nody-mc-nodeface'));

if ($actualException === null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,15 +551,15 @@ protected function requireNodeAggregateToBeSibling(
): void {
$succeedingSiblings = $contentGraph->getSubgraph(
$dimensionSpacePoint,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
)->findSucceedingSiblingNodes($referenceNodeAggregateId, FindSucceedingSiblingNodesFilter::create());
if ($succeedingSiblings->toNodeAggregateIds()->contain($siblingNodeAggregateId)) {
return;
}

$precedingSiblings = $contentGraph->getSubgraph(
$dimensionSpacePoint,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
)->findPrecedingSiblingNodes($referenceNodeAggregateId, FindPrecedingSiblingNodesFilter::create());
if ($precedingSiblings->toNodeAggregateIds()->contain($siblingNodeAggregateId)) {
return;
Expand All @@ -583,7 +583,7 @@ protected function requireNodeAggregateToBeChild(
): void {
$childNodes = $contentGraph->getSubgraph(
$dimensionSpacePoint,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
)->findChildNodes($parentNodeAggregateId, FindChildNodesFilter::create());
if ($childNodes->toNodeAggregateIds()->contain($childNodeAggregateId)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ private function resolveInterdimensionalSiblingsForCreation(
OriginDimensionSpacePoint $sourceOrigin,
DimensionSpacePointSet $coveredDimensionSpacePoints,
): InterdimensionalSiblings {
$subGraph = $contentGraph->getSubgraph($sourceOrigin->toDimensionSpacePoint(), VisibilityConstraints::withoutRestrictions());
$subGraph = $contentGraph->getSubgraph($sourceOrigin->toDimensionSpacePoint(), VisibilityConstraints::createEmpty());
$originAlternativeSucceedingSiblings = $subGraph->findSucceedingSiblingNodes(
$requestedSucceedingSiblingNodeAggregateId,
FindSucceedingSiblingNodesFilter::create()
);

$interdimensionalSiblings = [];
foreach ($coveredDimensionSpacePoints as $coveredDimensionSpacePoint) {
$subGraph = $contentGraph->getSubgraph($coveredDimensionSpacePoint, VisibilityConstraints::withoutRestrictions());
$subGraph = $contentGraph->getSubgraph($coveredDimensionSpacePoint, VisibilityConstraints::createEmpty());
$variantSucceedingSibling = $subGraph->findNodeById($requestedSucceedingSiblingNodeAggregateId);
if ($variantSucceedingSibling) {
// a) happy path, the explicitly requested succeeding sibling also exists in this dimension space point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private function findDimensionSpacePointsConnectingParentAndChildAggregate(
): DimensionSpacePointSet {
$points = [];
foreach ($childNodeAggregate->coveredDimensionSpacePoints as $coveredDimensionSpacePoint) {
$parentNode = $contentGraph->getSubgraph($coveredDimensionSpacePoint, VisibilityConstraints::withoutRestrictions())->findParentNode(
$parentNode = $contentGraph->getSubgraph($coveredDimensionSpacePoint, VisibilityConstraints::createEmpty())->findParentNode(
$childNodeAggregate->nodeAggregateId
);
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,14 @@ private function resolveInterdimensionalSiblings(
DimensionSpacePointSet $variantCoverage,
): InterdimensionalSiblings {
$originSiblings = $contentGraph
->getSubgraph($sourceOrigin->toDimensionSpacePoint(), VisibilityConstraints::withoutRestrictions())
->getSubgraph($sourceOrigin->toDimensionSpacePoint(), VisibilityConstraints::createEmpty())
->findSucceedingSiblingNodes($varyingNodeAggregateId, FindSucceedingSiblingNodesFilter::create());

$interdimensionalSiblings = [];
foreach ($variantCoverage as $variantDimensionSpacePoint) {
// check the siblings succeeding in the origin dimension space point
foreach ($originSiblings as $originSibling) {
$variantSibling = $contentGraph->getSubgraph($variantDimensionSpacePoint, VisibilityConstraints::withoutRestrictions())->findNodeById($originSibling->aggregateId);
$variantSibling = $contentGraph->getSubgraph($variantDimensionSpacePoint, VisibilityConstraints::createEmpty())->findNodeById($originSibling->aggregateId);
if (!$variantSibling) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private static function requireDimensionSpacePointToBeEmptyInContentStream(
ContentGraphInterface $contentGraph,
DimensionSpacePoint $dimensionSpacePoint
): void {
$hasNodes = $contentGraph->getSubgraph($dimensionSpacePoint, VisibilityConstraints::withoutRestrictions())->countNodes();
$hasNodes = $contentGraph->getSubgraph($dimensionSpacePoint, VisibilityConstraints::createEmpty())->countNodes();
if ($hasNodes > 0) {
throw new DimensionSpacePointAlreadyExists(sprintf(
'the content stream %s already contained nodes in dimension space point %s - this is not allowed.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private function resolveInterdimensionalSiblingsForMove(
): InterdimensionalSiblings {
$selectedSubgraph = $contentGraph->getSubgraph(
$selectedDimensionSpacePoint,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
$alternativeSucceedingSiblingIds = $succeedingSiblingId
? $selectedSubgraph->findSucceedingSiblingNodes(
Expand All @@ -268,7 +268,7 @@ private function resolveInterdimensionalSiblingsForMove(
foreach ($affectedDimensionSpacePoints as $dimensionSpacePoint) {
$variantSubgraph = $contentGraph->getSubgraph(
$dimensionSpacePoint,
VisibilityConstraints::withoutRestrictions()
VisibilityConstraints::createEmpty()
);
if ($succeedingSiblingId) {
$variantSucceedingSibling = $variantSubgraph->findNodeById($succeedingSiblingId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,25 @@
\JsonSerializable,
RebasableToOtherWorkspaceInterface
{
/**
* @deprecated with Neos 9 Beta 19. Must not be specified any longer. Might get removed at any point. Only part of the command to handle rebasing legacy events.
*/
public ?NodeAggregateId $removalAttachmentPoint;

/**
* @param WorkspaceName $workspaceName The workspace in which the remove operation is to be performed
* @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to remove
* @param DimensionSpacePoint $coveredDimensionSpacePoint One of the dimension space points covered by the node aggregate in which the user intends to remove it
* @param NodeVariantSelectionStrategy $nodeVariantSelectionStrategy The strategy the user chose to determine which specialization variants will also be removed
* @param NodeAggregateId|null $removalAttachmentPoint Internal. It stores the document node id of the removed node, as that is what the UI needs later on for the change display. {@see self::withRemovalAttachmentPoint()}
*/
private function __construct(
public WorkspaceName $workspaceName,
public NodeAggregateId $nodeAggregateId,
public DimensionSpacePoint $coveredDimensionSpacePoint,
public NodeVariantSelectionStrategy $nodeVariantSelectionStrategy,
public ?NodeAggregateId $removalAttachmentPoint
?NodeAggregateId $removalAttachmentPoint
) {
$this->removalAttachmentPoint = $removalAttachmentPoint;
}

/**
Expand All @@ -71,23 +76,6 @@ public static function fromArray(array $array): self
);
}

/**
* This adds usually the NodeAggregateId of the parent document node of the deleted node.
* It is needed for instance in the Neos UI for the following scenario:
* - when removing a node, you still need to be able to publish the removal.
* - For this to work, the Neos UI needs to know the id of the removed Node, **on the page where the removal happened**
* (so that the user can decide to publish a single page INCLUDING the removal on the page)
* - Because this command will *remove* the edge,
* we cannot know the position in the tree after doing the removal anymore.
*
* @param NodeAggregateId $removalAttachmentPoint
* @internal
*/
public function withRemovalAttachmentPoint(NodeAggregateId $removalAttachmentPoint): self
{
return new self($this->workspaceName, $this->nodeAggregateId, $this->coveredDimensionSpacePoint, $this->nodeVariantSelectionStrategy, $removalAttachmentPoint);
}

/**
* @return array<string,mixed>
*/
Expand All @@ -104,7 +92,7 @@ public function createCopyForWorkspace(
$this->nodeAggregateId,
$this->coveredDimensionSpacePoint,
$this->nodeVariantSelectionStrategy,
$this->removalAttachmentPoint,
$this->removalAttachmentPoint
);
}
}
Loading

0 comments on commit d716269

Please sign in to comment.