diff --git a/Neos.Neos/Classes/TypeConverter/HackyNodeAddressToNodeConverter.php b/Neos.Neos/Classes/TypeConverter/NodeAddressToNodeConverter.php similarity index 55% rename from Neos.Neos/Classes/TypeConverter/HackyNodeAddressToNodeConverter.php rename to Neos.Neos/Classes/TypeConverter/NodeAddressToNodeConverter.php index 9786c418fc9..c8744bb5eda 100644 --- a/Neos.Neos/Classes/TypeConverter/HackyNodeAddressToNodeConverter.php +++ b/Neos.Neos/Classes/TypeConverter/NodeAddressToNodeConverter.php @@ -16,25 +16,16 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; -use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; +use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; -use Neos\Flow\Core\Bootstrap; -use Neos\Flow\Http\RequestHandler; use Neos\Flow\Property\PropertyMappingConfigurationInterface; use Neos\Flow\Property\TypeConverter\AbstractTypeConverter; -use Neos\Neos\FrontendRouting\NodeAddressFactory; -use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult; /** - * To be removed legacy fragment for property mapping nodes in controllers. - * MUST not be used and MUST be removed before Neos 9 release. - * See issue: https://github.com/neos/neos-development-collection/issues/4873 - * * @Flow\Scope("singleton") - * @deprecated must be removed before Neos 9 release!!! */ -class HackyNodeAddressToNodeConverter extends AbstractTypeConverter +class NodeAddressToNodeConverter extends AbstractTypeConverter { /** * @var array @@ -53,8 +44,6 @@ class HackyNodeAddressToNodeConverter extends AbstractTypeConverter #[Flow\Inject] protected ContentRepositoryRegistry $contentRepositoryRegistry; - #[Flow\Inject] - protected Bootstrap $bootstrap; /** * @param string $source @@ -68,26 +57,16 @@ public function convertFrom( array $subProperties = [], PropertyMappingConfigurationInterface $configuration = null ) { - $activeRequestHandler = $this->bootstrap->getActiveRequestHandler(); - $contentRepositoryId = ContentRepositoryId::fromString('default'); - if ($activeRequestHandler instanceof RequestHandler) { - $httpRequest = $activeRequestHandler->getHttpRequest(); - $siteDetectionResult = SiteDetectionResult::fromRequest($httpRequest); - $contentRepositoryId = $siteDetectionResult->contentRepositoryId; - } - - $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); - $nodeAddressFactory = NodeAddressFactory::create($contentRepository); - $nodeAddress = $nodeAddressFactory->createFromUriString($source); - + $nodeAddress = NodeAddress::fromJsonString($source); + $contentRepository = $this->contentRepositoryRegistry->get($nodeAddress->contentRepositoryId); $subgraph = $contentRepository->getContentGraph($nodeAddress->workspaceName) ->getSubgraph( $nodeAddress->dimensionSpacePoint, - $nodeAddress->isInLiveWorkspace() + $nodeAddress->workspaceName->isLive() ? VisibilityConstraints::frontend() : VisibilityConstraints::withoutRestrictions() ); - return $subgraph->findNodeById($nodeAddress->nodeAggregateId); + return $subgraph->findNodeById($nodeAddress->aggregateId); } } diff --git a/Neos.Neos/Classes/TypeConverter/NodeToNodeAddressStringConverter.php b/Neos.Neos/Classes/TypeConverter/NodeToNodeAddressStringConverter.php index 7c296803ec8..cdb5f077c19 100644 --- a/Neos.Neos/Classes/TypeConverter/NodeToNodeAddressStringConverter.php +++ b/Neos.Neos/Classes/TypeConverter/NodeToNodeAddressStringConverter.php @@ -15,27 +15,19 @@ namespace Neos\Neos\TypeConverter; 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\Property\PropertyMappingConfigurationInterface; use Neos\Flow\Property\TypeConverter\AbstractTypeConverter; -use Neos\Neos\FrontendRouting\NodeAddressFactory; /** - * To be removed legacy fragment for property mapping nodes in controllers. - * MUST not be used and MUST be removed before Neos 9 release. - * See issue: https://github.com/neos/neos-development-collection/issues/4873 - * * @Flow\Scope("singleton") - * @deprecated must be removed before Neos 9 release!!! */ class NodeToNodeAddressStringConverter extends AbstractTypeConverter { - /** - * @Flow\Inject - * @var ContentRepositoryRegistry - */ - protected $contentRepositoryRegistry; + #[Flow\Inject] + protected ContentRepositoryRegistry $contentRepositoryRegistry; /** * @var array @@ -64,9 +56,6 @@ public function convertFrom( array $subProperties = [], PropertyMappingConfigurationInterface $configuration = null ) { - $contentRepository = $this->contentRepositoryRegistry->get( - $source->contentRepositoryId - ); - return NodeAddressFactory::create($contentRepository)->createFromNode($source)->serializeForUri(); + return NodeAddress::fromNode($source)->toJson(); } }