Skip to content

Commit

Permalink
TASK: Remove usages to NodeAddressFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Oct 14, 2024
1 parent 321e171 commit 875d575
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 217 deletions.
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

0 comments on commit 875d575

Please sign in to comment.