Closed mhsdesign closed 1 month ago
I guess the reason for this not existing is that the node might not even belong to the given content repository
touché we could add a content repository id check
public function subgraphForNode(Node $node): ContentSubgraphInterface
{
return $this->subgraphForIdentity(ContentSubgraphIdentity::fromNode($node));
}
public function subgraphForIdentity(ContentSubgraphIdentity $identity): ContentSubgraphInterface
{
if (!$this->id->equals($identity->contentRepositoryId)) {
throw new ForeignContentRepositoryUsed(
sprintf('ContentRepository "%s" cannot get subgraph for Node of ContentRepository "%s".', $this->id->value, $node->contentRepositoryId->value),
1715531407
);
}
return $this->getContentGraph($identity->workspaceName)->getSubgraph(
$identity->dimensionSpacePoint,
$identity->visibilityConstraints
);
}
public function subgraphFor(WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, VisibilityConstraints $visibilityConstraints): ContentSubgraphInterface
{
return $this->getContentGraph($workspaceName)->getSubgraph(
$dimensionSpacePoint,
$visibilityConstraints
);
}
as of now we concluded that shortcuts like these are not worth it yet
Discussion moved to https://github.com/neos/neos-development-collection/issues/5065
Seeing code like this
this seems just double because the contentRepository is fetched twice and not passed
makes me rethink if were not going to far with
contentRepositoryRegistry->subgraphForNode
, id like to fetch the cr more often in code directly and then get the subgraph:Upgrade instructions
Review instructions
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions