Skip to content

Commit

Permalink
TASK: Fully remove aggregate=true
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Nov 19, 2024
1 parent acc07c8 commit 56953bd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 65 deletions.
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
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

0 comments on commit 56953bd

Please sign in to comment.