Skip to content

Commit 30232f9

Browse files
Merge pull request #56 from punktDeForks/bugfix/fix-removal-for-fallback-dimensions
BUGFIX: node removal for nodes with fallback dimensions
2 parents 88862b8 + f0ef17a commit 30232f9

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

Classes/Indexer/NodeIndexer.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,32 @@ public function removeNode(NodeInterface $node, string $targetWorkspaceName = nu
104104
}
105105
}
106106

107-
$removalJob = new RemovalJob($this->indexNamePostfix, $targetWorkspaceName, $this->nodeAsArray($node));
108-
$this->jobManager->queue(NodeIndexQueueCommandController::LIVE_QUEUE_NAME, $removalJob);
107+
$dimensionCombinations = $this->dimensionService->getDimensionCombinationsForIndexing($node);
108+
109+
if (array_filter($dimensionCombinations) === []) {
110+
$removalJob = new RemovalJob($this->indexNamePostfix, $targetWorkspaceName, $this->nodeAsArray($node));
111+
$this->jobManager->queue(NodeIndexQueueCommandController::LIVE_QUEUE_NAME, $removalJob);
112+
} else {
113+
foreach ($dimensionCombinations as $combination) {
114+
115+
$nodeFromContext = $this->createContentContext($targetWorkspaceName, $combination)->getNodeByIdentifier($node->getIdentifier());
116+
if ($nodeFromContext instanceof NodeInterface && !$nodeFromContext->isRemoved()) {
117+
continue;
118+
}
119+
120+
$fakeNodeArray = [
121+
'persistenceObjectIdentifier' => 'fake',
122+
'workspace' => $node->getWorkspace()->getName(),
123+
'path' => $node->getPath(),
124+
'identifier' => $node->getIdentifier(),
125+
'nodeType' => $node->getNodeType()->getName(),
126+
'dimensions' => $combination
127+
];
128+
129+
$removalJob = new RemovalJob($this->indexNamePostfix, $targetWorkspaceName, [$fakeNodeArray]);
130+
$this->jobManager->queue(NodeIndexQueueCommandController::LIVE_QUEUE_NAME, $removalJob);
131+
}
132+
}
109133
}
110134

111135
/**

0 commit comments

Comments
 (0)