-
-
Notifications
You must be signed in to change notification settings - Fork 222
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: Refactor Node
property mapper to use new NodeAddress
#5068
Changes from all commits
97c9445
ba79300
6d72c8a
931304f
0f90905
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,16 +22,6 @@ | |
use Neos\Flow\Annotations as Flow; | ||
|
||
/** | ||
* A persistent, external "address" of a node; used to link to it. | ||
* | ||
* Describes the intention of the user making the current request: | ||
* Show me | ||
* node $nodeAggregateId | ||
* in dimensions $dimensionSpacePoint | ||
* in contentStreamId $contentStreamId | ||
* | ||
* It is used in Neos Routing to build a URI to a node. | ||
* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove those? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because its just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, thanks for clarifying, I briefly confused the two |
||
* @deprecated will be removed before Final 9.0 | ||
* The NodeAddress was added 6 years ago without the concept of multiple crs | ||
* Its usages will be replaced by the new node attached node address | ||
|
@@ -42,8 +32,9 @@ | |
/** | ||
* @internal use NodeAddressFactory, if you want to create a NodeAddress | ||
*/ | ||
/** @phpstan-ignore-next-line its all just temporary */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you elaborate the comment a bit? Why do we need it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i dindt want to remove the param yet as it would break the neos ui now (we construct it over there) this is just intermediate |
||
public function __construct( | ||
public ContentStreamId $contentStreamId, | ||
?ContentStreamId $_contentStreamId, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume, you just kept this to keep the PR smaller? But is it necessary to rename the parameter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its just a dummy stub, and |
||
public DimensionSpacePoint $dimensionSpacePoint, | ||
public NodeAggregateId $nodeAggregateId, | ||
public WorkspaceName $workspaceName | ||
|
@@ -59,16 +50,10 @@ public function serializeForUri(): string | |
. '__' . $this->nodeAggregateId->value; | ||
} | ||
|
||
public function isInLiveWorkspace(): bool | ||
{ | ||
return $this->workspaceName->isLive(); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return sprintf( | ||
'NodeAddress[contentStream=%s, dimensionSpacePoint=%s, nodeAggregateId=%s, workspaceName=%s]', | ||
$this->contentStreamId->value, | ||
'NodeAddress[dimensionSpacePoint=%s, nodeAggregateId=%s, workspaceName=%s]', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hope that we don' relay on this string representation (=> do we really need it, what about using __debugInfo() instead?) – and if we keep it: Why did you decide to move the workspace name to the end? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we probably dont even need the |
||
$this->dimensionSpacePoint->toJson(), | ||
$this->nodeAggregateId->value, | ||
$this->workspaceName->value | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -15,9 +15,14 @@ | |||||
namespace Neos\Neos\Service\Controller; | ||||||
|
||||||
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\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; | ||||||
|
@@ -30,6 +35,9 @@ | |||||
*/ | ||||||
class DataSourceController extends AbstractServiceController | ||||||
{ | ||||||
#[Flow\Inject] | ||||||
protected ContentRepositoryRegistry $contentRepositoryRegistry; | ||||||
|
||||||
/** | ||||||
* @var array<string,class-string> | ||||||
*/ | ||||||
|
@@ -39,10 +47,9 @@ class DataSourceController extends AbstractServiceController | |||||
|
||||||
/** | ||||||
* @param string $dataSourceIdentifier | ||||||
* @param Node $node | ||||||
* @throws NeosException | ||||||
*/ | ||||||
public function indexAction($dataSourceIdentifier, Node $node = null): void | ||||||
public function indexAction($dataSourceIdentifier, string $node = null): void | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you removed the param annotation – I would instead suggest to keep it and add some docs instead – what is this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as per my main description:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, sorry, missed that one! |
||||||
{ | ||||||
$dataSources = static::getDataSources($this->objectManager); | ||||||
|
||||||
|
@@ -63,11 +70,29 @@ public function indexAction($dataSourceIdentifier, Node $node = null): void | |||||
unset($arguments['dataSourceIdentifier']); | ||||||
unset($arguments['node']); | ||||||
|
||||||
$values = $dataSource->getData($node, $arguments); | ||||||
$values = $dataSource->getData($this->deserializeNodeFromLegacyAddress($node), $arguments); | ||||||
|
||||||
$this->view->assign('value', $values); | ||||||
} | ||||||
|
||||||
private function deserializeNodeFromLegacyAddress(?string $stringFormattedNodeAddress): ?Node | ||||||
{ | ||||||
if (!$stringFormattedNodeAddress) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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); | ||||||
|
||||||
return $contentRepository->getContentGraph($nodeAddress->workspaceName)->getSubgraph( | ||||||
$nodeAddress->dimensionSpacePoint, | ||||||
VisibilityConstraints::withoutRestrictions() | ||||||
)->findNodeById($nodeAddress->aggregateId); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Get available data source implementations | ||||||
* | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO is related to line 149, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jip a followup will change the whole neos ui and neos.neos to work on the new format we agreed upon.