Skip to content

Commit

Permalink
WIP: Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed May 11, 2024
1 parent d0cdf6f commit b90b043
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
20 changes: 10 additions & 10 deletions Neos.Neos/Classes/FrontendRouting/NodeShortcutResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use GuzzleHttp\Psr7\Uri;
use Neos\ContentRepository\Core\ContentRepository;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeIdentity;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\ResourceManagement\ResourceManager;
Expand Down Expand Up @@ -50,31 +50,31 @@ public function __construct(
* Note: The ContentStreamId is not required for this service,
* because it is only covering the live workspace
*
* @return NodeIdentity|UriInterface NodeIdentity is returned if we want to link to another node
* @return NodeAddress|UriInterface NodeIdentity is returned if we want to link to another node
* (i.e. node is NOT a shortcut node; or target is a node);
* or UriInterface for links to fixed URLs (Asset URLs or external URLs)
* @throws \Neos\Neos\FrontendRouting\Exception\InvalidShortcutException
* @throws NodeNotFoundException
*/
public function resolveShortcutTarget(NodeIdentity $nodeIdentity)
public function resolveShortcutTarget(NodeAddress $nodeAddress)
{
if (!$nodeIdentity->workspaceName->isLive()) {
throw new \RuntimeException(sprintf('Cannot resolve shortcut target for node-address %s in workspace %s because the DocumentUriPathProjection only handles the live workspace.', $nodeIdentity->nodeAggregateId->value, $nodeIdentity->workspaceName->value), 1707208650);
if (!$nodeAddress->workspaceName->isLive()) {
throw new \RuntimeException(sprintf('Cannot resolve shortcut target for node-address %s in workspace %s because the DocumentUriPathProjection only handles the live workspace.', $nodeAddress->aggregateId->value, $nodeAddress->workspaceName->value), 1707208650);
}
$contentRepository = $this->contentRepositoryRegistry->get($nodeIdentity->contentRepositoryId);
$contentRepository = $this->contentRepositoryRegistry->get($nodeAddress->contentRepositoryId);
$documentUriPathFinder = $contentRepository->projectionState(DocumentUriPathFinder::class);
$documentNodeInfo = $documentUriPathFinder->getByIdAndDimensionSpacePointHash(
$nodeIdentity->nodeAggregateId,
$nodeIdentity->dimensionSpacePoint->hash
$nodeAddress->aggregateId,
$nodeAddress->dimensionSpacePoint->hash
);
$resolvedTarget = $this->resolveNode($documentNodeInfo, $contentRepository);
if ($resolvedTarget instanceof UriInterface) {
return $resolvedTarget;
}
if ($resolvedTarget === $documentNodeInfo) {
return $nodeIdentity;
return $nodeAddress;
}
return $nodeIdentity->withNodeAggregateId($documentNodeInfo->getNodeAggregateId());
return $nodeAddress->withAggregateId($documentNodeInfo->getNodeAggregateId());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Neos.Neos/Classes/Fusion/Cache/CacheTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ final public static function forNodeTypeName(

final public static function forDynamicNodeAggregate(
ContentRepositoryId $contentRepositoryId,
WorkspaceName $workspaceName,
WorkspaceName|ContentStreamId $workspaceName,
NodeAggregateId $nodeAggregateId,
): self {
return new self(
Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function evaluate()
$unresolvedUris = [];
$absolute = $this->fusionValue('absolute');

$processedContent = preg_replace_callback(self::PATTERN_SUPPORTED_URIS, function (array $matches) use ($contentRepository, $nodeAddress, &$unresolvedUris, $absolute) {
$processedContent = preg_replace_callback(self::PATTERN_SUPPORTED_URIS, function (array $matches) use ($nodeAddress, &$unresolvedUris, $absolute) {
$resolvedUri = null;
switch ($matches[1]) {
case 'node':
Expand All @@ -174,7 +174,7 @@ public function evaluate()
$this->systemLogger->warning(sprintf('Could not resolve "%s" to a node uri.', $matches[0]), LogEnvironment::fromMethodName(__METHOD__));
}
$this->runtime->addCacheTag(
CacheTag::forDynamicNodeAggregate($nodeAddress->contentRepositoryId, $nodeAddress->workspaceName, $nodeAddress->nodeAggregateId)->value
CacheTag::forDynamicNodeAggregate($nodeAddress->contentRepositoryId, $nodeAddress->workspaceName, $nodeAddress->aggregateId)->value
);
break;
case 'asset':
Expand Down
1 change: 1 addition & 0 deletions Neos.Neos/Classes/Fusion/NodeUriImplementation.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace Neos\Neos\Fusion;

use GuzzleHttp\Psr7\Uri;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
Expand Down

0 comments on commit b90b043

Please sign in to comment.