Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Remove obsolete aggregate as Neos Ui handles nodeMove strategy now via special configuration #5314

Merged
merged 19 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private function __construct(
* @param WorkspaceName $workspaceName The workspace in which the move operation is to be performed
* @param DimensionSpacePoint $dimensionSpacePoint This is one of the *covered* dimension space points of the node aggregate and not necessarily one of the occupied ones. This allows us to move virtual specializations only when using the scatter strategy
* @param NodeAggregateId $nodeAggregateId The id of the node aggregate to move
* @param RelationDistributionStrategy $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy})
* @param RelationDistributionStrategy $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}).
* @param NodeAggregateId|null $newParentNodeAggregateId The id of the new parent node aggregate. If given, it enforces that all nodes in the given aggregate are moved into nodes of the parent aggregate, even if the given siblings belong to other parents. In latter case, those siblings are ignored
* @param NodeAggregateId|null $newPrecedingSiblingNodeAggregateId The id of the new preceding sibling node aggregate. If given and no successor found, it is attempted to insert the moved nodes right after nodes of this aggregate. In dimension space points this aggregate does not cover, other siblings, in order of proximity, are tried to be used instead
* @param NodeAggregateId|null $newSucceedingSiblingNodeAggregateId The id of the new succeeding sibling node aggregate. If given, it is attempted to insert the moved nodes right before nodes of this aggregate. In dimension space points this aggregate does not cover, the preceding sibling is tried to be used instead
Expand Down
19 changes: 0 additions & 19 deletions Neos.ContentRepository.Core/Classes/NodeType/NodeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,25 +291,6 @@ public function getDeclaredSuperTypes(): array
});
}

/**
* Returns whether this node type (or any parent type) is an *aggregate*.
*
* The most prominent *aggregate* is a Document and everything which inherits from it, like a Page.
*
* If a node type is marked as aggregate, it means that:
*
* - the node type can "live on its own", i.e. can be part of an external URL
* - when moving this node, all node variants are also moved (across all dimensions)
* - Recursive copying only happens *inside* this aggregate, and stops at nested aggregates.
*
* @return boolean true if the node type is an aggregate
* @api
*/
public function isAggregate(): bool
{
return $this->getConfiguration('aggregate') === true;
}

/**
* If this node type or any of the direct or indirect super types
* has the given name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ protected function prepareNodeTypeManager(array $nodeTypesFixtureData)
],
'Neos.ContentRepository.Testing:Document' => [
'abstract' => true,
'aggregate' => true
],
'Neos.ContentRepository.Testing:Page' => [
'superTypes' => ['Neos.ContentRepository.Testing:Document' => true],
Expand Down Expand Up @@ -273,23 +272,6 @@ public function getNodeTypeAllowsToRetrieveFinalNodeTypes()
self::assertTrue($this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:MyFinalType')->isFinal());
}

/**
* @test
*/
public function aggregateNodeTypeFlagIsFalseByDefault()
{
self::assertFalse($this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Text')->isAggregate());
}

/**
* @test
*/
public function aggregateNodeTypeFlagIsInherited()
{
self::assertTrue($this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Document')->isAggregate());
self::assertTrue($this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Page')->isAggregate());
}

/**
* @test
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ additionalProperties:
'class': { type: string, format: class-name }
'abstract': { type: boolean, description: "Abstract node type for default/mixin usage" }
'final': { type: boolean, description: "If final, this node type cannot be subclassed" }
'aggregate': { type: boolean, description: "INTERNAL. If aggregate, this node type is something like a Document. If not aggregate, it is seen as part of an aggregate node type - has influence on how e.g. moving of nodes across dimensions work." }

'superTypes':
type: dictionary
Expand Down
22 changes: 4 additions & 18 deletions Neos.Neos/Classes/Controller/Service/NodesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,15 @@ protected function addExistingNodeVariantInformationToResponse(
// If the node exists in another dimension, we want to know how many nodes in the rootline are also
// missing for the target dimension. This is needed in the UI to tell the user if nodes will be
// materialized recursively upwards in the rootline. To find the node path for the given identifier,
// we just use the first result. This is a safe assumption at least for "Document" nodes (aggregate=true),
// because they are always moved in-sync.
if ($nodeTypeManager->getNodeType($nodeAggregate->nodeTypeName)?->isAggregate()) {
// we just use the first result. This is a safe assumption at least for "Document" nodes ,
// because they are always moved in-sync by default via (options.moveNodeStrategy=gatherAll).
if ($nodeTypeManager->getNodeType($nodeAggregate->nodeTypeName)?->isOfType(NodeTypeNameFactory::NAME_DOCUMENT)) {
// TODO: we would need the SourceDimensions parameter (as in Create()) to ensure the correct
// rootline is traversed. Here, we, as a workaround, simply use the 1st aggregate for now.

$missingNodesOnRootline = 0;
while (
$parentAggregate = self::firstNodeAggregate(
$contentGraph->findParentNodeAggregates($identifier)
)
$parentAggregate = $contentGraph->findParentNodeAggregates($identifier)->first()
) {
if (!$parentAggregate->coversDimensionSpacePoint($dimensionSpacePoint)) {
$missingNodesOnRootline++;
Expand All @@ -361,18 +359,6 @@ protected function addExistingNodeVariantInformationToResponse(
}
}

/**
* @param iterable<NodeAggregate> $nodeAggregates
* @return NodeAggregate|null
*/
private static function firstNodeAggregate(iterable $nodeAggregates): ?NodeAggregate
{
foreach ($nodeAggregates as $nodeAggregate) {
return $nodeAggregate;
}
return null;
}

/**
* Adopt (translate) the given node and parents that are not yet visible to the given context
*
Expand Down
10 changes: 0 additions & 10 deletions Neos.Neos/Documentation/References/NodeTypeDefinition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ The following options are allowed for defining a NodeType:
Abstract node types are useful when using inheritance and composition, so mark base node types and
mixins as abstract.

``aggregate``
A boolean flag, marking a node type as *aggregate*. If a node type is marked as aggregate, it means that:

- the node type can "live on its own", i.e. can be part of an external URL
- when moving this node, all node variants are also moved (across all dimensions)
- Recursive copying only happens *inside* this aggregate, and stops at nested aggregates.

The most prominent *aggregate* is `Neos.Neos:Document` and everything which inherits from it, like
`Neos.NodeTypes:Page`.

``superTypes``
An array of parent node types as keys with a boolean value::

Expand Down
1 change: 0 additions & 1 deletion Neos.Neos/NodeTypes/Mixin/Document.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
'Neos.Neos:Node': true
'Neos.Neos:Hidable': true
abstract: true
aggregate: true
constraints:
nodeTypes:
'*': false
Expand Down
Loading