Skip to content

Commit 3def40e

Browse files
committed
TASK: refactor API for findNodeAggregates
I forgot to change this after discussing in neos/neos-development-collection#4093 so this is the cleanup commit.
1 parent 167101d commit 3def40e

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Classes/Projection/ContentGraph/ContentGraphInterface.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ public function getSubgraph(
4646
): ContentSubgraphInterface;
4747

4848
/**
49-
* @deprecated please use {@see findRootNodeAggregates} instead
50-
* @internal
49+
* @api
50+
* Throws exception if no root aggregate found, because a Content Repository needs at least
51+
* one root node to function.
5152
*/
5253
public function findRootNodeAggregateByType(
5354
ContentStreamId $contentStreamId,

Classes/Projection/ContentGraph/NodeAggregates.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,14 @@ public function count(): int
7474
}
7575

7676
/**
77-
* Throws exception if no root aggregate found, because a Content Repository needs at least
78-
* one root node to function.
79-
*
80-
* @return NodeAggregate
77+
* @return NodeAggregate|null
8178
*/
82-
public function first(): NodeAggregate
79+
public function first(): ?NodeAggregate
8380
{
8481
if (count($this->nodeAggregates) > 0) {
8582
$array = $this->nodeAggregates;
8683
return reset($array);
8784
}
88-
throw new \RuntimeException('Root Node Aggregate not found');
85+
return null;
8986
}
9087
}

0 commit comments

Comments
 (0)