Skip to content

Commit

Permalink
TASK: Solve todo in TetheredNodeAdjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed May 11, 2024
1 parent e2c79b6 commit 1a7705e
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ public function findAdjustmentsForNodeType(NodeTypeName $nodeTypeName): \Generat
$expectedTetheredNodes = $this->nodeTypeManager->getTetheredNodesConfigurationForNodeType($nodeType);

foreach ($this->projectedNodeIterator->nodeAggregatesOfType($nodeTypeName) as $nodeAggregate) {
// TODO: We should use $nodeAggregate->workspaceName as soon as it's available
$contentGraph = $this->contentRepository->getContentGraph(WorkspaceName::forLive());
// find missing tethered nodes
$foundMissingOrDisallowedTetheredNodes = false;
$originDimensionSpacePoints = $nodeType->isOfType(NodeTypeName::ROOT_NODE_TYPE_NAME)
Expand All @@ -69,7 +67,7 @@ public function findAdjustmentsForNodeType(NodeTypeName $nodeTypeName): \Generat
foreach ($expectedTetheredNodes as $tetheredNodeName => $expectedTetheredNodeType) {
$tetheredNodeName = NodeName::fromString($tetheredNodeName);

$tetheredNode = $contentGraph->getSubgraph(
$tetheredNode = $this->projectedNodeIterator->contentGraph->getSubgraph(
$originDimensionSpacePoint->toDimensionSpacePoint(),
VisibilityConstraints::withoutRestrictions()
)->findNodeByPath(
Expand All @@ -86,9 +84,9 @@ public function findAdjustmentsForNodeType(NodeTypeName $nodeTypeName): \Generat
$nodeAggregate->nodeAggregateId,
StructureAdjustment::TETHERED_NODE_MISSING,
'The tethered child node "' . $tetheredNodeName->value . '" is missing.',
function () use ($nodeAggregate, $originDimensionSpacePoint, $tetheredNodeName, $expectedTetheredNodeType, $contentGraph) {
function () use ($nodeAggregate, $originDimensionSpacePoint, $tetheredNodeName, $expectedTetheredNodeType) {
$events = $this->createEventsForMissingTetheredNode(
$contentGraph,
$this->projectedNodeIterator->contentGraph,
$nodeAggregate,
$originDimensionSpacePoint,
$tetheredNodeName,
Expand All @@ -112,7 +110,7 @@ function () use ($nodeAggregate, $originDimensionSpacePoint, $tetheredNodeName,
}

// find disallowed tethered nodes
$tetheredNodeAggregates = $contentGraph->findTetheredChildNodeAggregates(
$tetheredNodeAggregates = $this->projectedNodeIterator->contentGraph->findTetheredChildNodeAggregates(
$nodeAggregate->nodeAggregateId
);
foreach ($tetheredNodeAggregates as $tetheredNodeAggregate) {
Expand All @@ -134,7 +132,7 @@ function () use ($tetheredNodeAggregate) {
// find wrongly ordered tethered nodes
if ($foundMissingOrDisallowedTetheredNodes === false) {
foreach ($originDimensionSpacePoints as $originDimensionSpacePoint) {
$childNodes = $contentGraph->getSubgraph($originDimensionSpacePoint->toDimensionSpacePoint(), VisibilityConstraints::withoutRestrictions())->findChildNodes($nodeAggregate->nodeAggregateId, FindChildNodesFilter::create());
$childNodes = $this->projectedNodeIterator->contentGraph->getSubgraph($originDimensionSpacePoint->toDimensionSpacePoint(), VisibilityConstraints::withoutRestrictions())->findChildNodes($nodeAggregate->nodeAggregateId, FindChildNodesFilter::create());

/** is indexed by node name, and the value is the tethered node itself */
$actualTetheredChildNodes = [];
Expand Down

0 comments on commit 1a7705e

Please sign in to comment.