Hi everyone,
hope some one can help me by this task (Neos 4.3).
I’m building an AWS CloudFront Cache Invalidator and need the relativ url to the published node document (for live workspace).
I have the signal with the node and the workspace working, the invalidation for CloudFront but im struggling with the getting the relative path.
public function afterNodePublishing($node, Workspace $targetWorkspace): void
{
$workspaceName = $targetWorkspace->getName();
if ($workspaceName !== 'live') {
return;
}
$contentContext = $this->contextFactory->create(array(
'workspaceName' => 'live',
'currentSite' => $node->getContext()->getCurrentSite()
));
$liveNode = (new FlowQuery(array($node)))->context(array('workspaceName' => 'live'))->get(0);
$controllerContext = new ControllerContext(
$this->uriBuilder->getRequest(),
new Response(),
new Arguments(array()),
$this->uriBuilder
);
//@TODO: Render relative URL to pass it to cloudfront - currently not working
$relativeHttpNodeUrl = $this->linkingService->createNodeUri(
$controllerContext,
$liveNode
);
if (empty($relativeHttpNodeUrl)){
return;
}
}
Any hints what I’m doing wrong?
As soon as it is working, I’ll make it a public package.
Thank you!