Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Remove legacy NodeAddress and NodeAddressFactory #5267

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions Neos.Neos/Classes/Controller/Backend/ContentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Controller\ActionController;
Expand All @@ -38,8 +39,6 @@
use Neos\Media\TypeConverter\AssetInterfaceConverter;
use Neos\Media\TypeConverter\ImageInterfaceArrayPresenter;
use Neos\Neos\Controller\BackendUserTranslationTrait;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
use Neos\Neos\TypeConverter\EntityToIdentityConverter;
use Neos\Neos\Utility\NodeTypeWithFallbackProvider;

Expand Down Expand Up @@ -146,13 +145,9 @@ public function initializeUploadAssetAction(): void
*/
public function uploadAssetAction(Asset $asset, string $metadata, string $node, string $propertyName)
{
$nodeAddressString = $node;
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())
->contentRepositoryId;
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
// todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress
$nodeAddress = NodeAddressFactory::create($contentRepository)->createCoreNodeAddressFromLegacyUriString($nodeAddressString);
$nodeAddress = NodeAddress::fromJsonString($node);

$contentRepository = $this->contentRepositoryRegistry->get($nodeAddress->contentRepositoryId);
$node = $contentRepository->getContentGraph($nodeAddress->workspaceName)
->getSubgraph(
$nodeAddress->dimensionSpacePoint,
Expand Down
8 changes: 3 additions & 5 deletions Neos.Neos/Classes/Controller/Service/NodesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\SearchTerm\SearchTerm;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\SearchTerm\SearchTermMatcher;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregate;
use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
Expand All @@ -39,7 +39,6 @@
use Neos\FluidAdaptor\View\TemplateView;
use Neos\Neos\Controller\BackendUserTranslationTrait;
use Neos\Neos\Domain\Service\NodeTypeNameFactory;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
use Neos\Neos\Ui\Domain\Service\NodePropertyConverterService;
use Neos\Neos\View\Service\NodeJsonView;
Expand Down Expand Up @@ -130,9 +129,8 @@ public function indexAction(
: null;
$nodeAddress = null;
if (!$nodePath) {
// todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress
$nodeAddress = $contextNode
? NodeAddressFactory::create($contentRepository)->createCoreNodeAddressFromLegacyUriString($contextNode)
? NodeAddress::fromJsonString($contextNode)
: null;
}

Expand Down Expand Up @@ -238,7 +236,7 @@ public function showAction(string $identifier, string $workspaceName = 'live', a
}
});

$nodeAddress = NodeAddressFactory::create($contentRepository)->createFromNode($node)->serializeForUri();
$nodeAddress = NodeAddress::fromNode($node)->toJson();

$this->view->assignMultiple([
'node' => $node,
Expand Down
62 changes: 0 additions & 62 deletions Neos.Neos/Classes/FrontendRouting/NodeAddress.php

This file was deleted.

80 changes: 0 additions & 80 deletions Neos.Neos/Classes/FrontendRouting/NodeAddressFactory.php

This file was deleted.

3 changes: 0 additions & 3 deletions Neos.Neos/Classes/Routing/NodeIdentityConverterAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\Neos\FrontendRouting\NodeAddress as LegacyNodeAddress;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Aop\JoinPointInterface;

Expand Down Expand Up @@ -47,8 +46,6 @@ public function convertNodeToContextPathForRouting(JoinPointInterface $joinPoint
return ['__contextNodePath' => NodeAddress::fromNode($objectArgument)->toJson()];
} elseif ($objectArgument instanceof NodeAddress) {
return ['__contextNodePath' => $objectArgument->toJson()];
} elseif ($objectArgument instanceof LegacyNodeAddress) {
return ['__contextNodePath' => $objectArgument->serializeForUri()];
}

return $joinPoint->getAdviceChain()->proceed($joinPoint);
Expand Down
6 changes: 2 additions & 4 deletions Neos.Neos/Classes/Service/ContentElementEditableService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
namespace Neos\Neos\Service;

use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Security\Authorization\PrivilegeManagerInterface;
use Neos\Fusion\Service\HtmlAugmenter as FusionHtmlAugmenter;
use Neos\Neos\FrontendRouting\NodeAddressFactory;

/**
* The content element editable service adds the necessary markup around
Expand Down Expand Up @@ -61,9 +61,7 @@ public function wrapContentProperty(Node $node, string $property, string $conten

$attributes = [
'data-__neos-property' => $property,
'data-__neos-editable-node-contextpath' => NodeAddressFactory::create($contentRepository)
->createFromNode($node)
->serializeForUri()
'data-__neos-editable-node-contextpath' => NodeAddress::fromNode($node)->toJson()
];

return $this->htmlAugmenter->addAttributes($content, $attributes, 'span');
Expand Down
6 changes: 3 additions & 3 deletions Neos.Neos/Classes/Service/ContentElementWrappingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
namespace Neos\Neos\Service;

use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Fusion\Service\HtmlAugmenter as FusionHtmlAugmenter;
use Neos\Neos\FrontendRouting\NodeAddressFactory;

/**
* The content element wrapping service adds the necessary markup around
Expand Down Expand Up @@ -62,10 +62,10 @@ public function wrapContentObject(
//}


$nodeAddress = NodeAddressFactory::create($contentRepository)->createFromNode($node);
$nodeAddress = NodeAddress::fromNode($node);
$attributes = $additionalAttributes;
$attributes['data-__neos-fusion-path'] = $fusionPath;
$attributes['data-__neos-node-contextpath'] = $nodeAddress->serializeForUri();
$attributes['data-__neos-node-contextpath'] = $nodeAddress->toJson();

// Define all attribute names as exclusive via the `exclusiveAttributes` parameter, to prevent the data of
// two different nodes to be concatenated into the attributes of a single html node.
Expand Down
11 changes: 3 additions & 8 deletions Neos.Neos/Classes/Service/Controller/DataSourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\View\JsonView;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
use Neos\Utility\ObjectAccess;
use Neos\Flow\Reflection\ReflectionService;
use Neos\Neos\Exception as NeosException;
use Neos\Neos\Service\DataSource\DataSourceInterface;
use Neos\Utility\ObjectAccess;

/**
* Data Source Controller
Expand Down Expand Up @@ -81,12 +79,9 @@ private function deserializeNodeFromLegacyAddress(?string $stringFormattedNodeAd
return null;
}

$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())
->contentRepositoryId;
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
// todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress
$nodeAddress = NodeAddressFactory::create($contentRepository)->createCoreNodeAddressFromLegacyUriString($stringFormattedNodeAddress);
$nodeAddress = NodeAddress::fromJsonString($stringFormattedNodeAddress);

$contentRepository = $this->contentRepositoryRegistry->get($nodeAddress->contentRepositoryId);
return $contentRepository->getContentGraph($nodeAddress->workspaceName)->getSubgraph(
$nodeAddress->dimensionSpacePoint,
VisibilityConstraints::withoutRestrictions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

namespace Neos\Neos\TypeConverter;

use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Property\PropertyMappingConfigurationInterface;
use Neos\Flow\Property\TypeConverter\AbstractTypeConverter;
use Neos\Neos\FrontendRouting\NodeAddress;

/**
* An Object Converter for Node Addresses which can be used for routing (but also for other
Expand Down Expand Up @@ -53,6 +53,6 @@ public function convertFrom(
array $convertedChildProperties = [],
PropertyMappingConfigurationInterface $configuration = null
): string {
return $source->serializeForUri();
return $source->toJson();
}
}
Loading
Loading