-
-
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
!!! TASK: Refactor Node
property mapper to use new NodeAddress
#5068
Conversation
2053ce7
to
106cde2
Compare
…ly instead of property mapping
106cde2
to
931304f
Compare
Node
property mapper to use new NodeAddress
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.
I just left some comments on first flyover, but I don't understand all the implications yet
@@ -150,14 +150,15 @@ public function uploadAssetAction(Asset $asset, string $metadata, string $node, | |||
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest()) | |||
->contentRepositoryId; | |||
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); | |||
$nodeAddress = NodeAddressFactory::create($contentRepository)->createFromUriString($nodeAddressString); | |||
// todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress |
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.
* 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
because its just @deprecated
and will be removed soon.
The statements are not true anymore: 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Right, thanks for clarifying, I briefly confused the two NodeAddress
es.. Good that we are getting rid of one :)
@@ -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 comment
The 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 comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
its just a dummy stub, and _
indicates its unused. the class will be obliterated into nothing.
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
we probably dont even need the __toString
anymore at this time ... but i kept it ... it will all go away. Its legacy.
* @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 comment
The 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 $node
string expected to contain?
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.
as per my main description:
where previously Node $node was used to trigger property mapping (DataSourceController and WorkspaceController) we now pass the node as string and use the legacy node address factory to handle the legacy format manually. A followup will adjust everything to work with the new node address.
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.
OK, sorry, missed that one!
|
||
$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 comment
The reason will be displayed to describe this comment to others. Learn more.
if (!$stringFormattedNodeAddress) { | |
if ($stringFormattedNodeAddress === null) { |
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.
regarding the why of this change, i tried to put it into words in my main description above but i would also be happy to elaborate on that or have a quick huddle.
@@ -150,14 +150,15 @@ public function uploadAssetAction(Asset $asset, string $metadata, string $node, | |||
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest()) | |||
->contentRepositoryId; | |||
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); | |||
$nodeAddress = NodeAddressFactory::create($contentRepository)->createFromUriString($nodeAddressString); | |||
// todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress |
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.
* 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 comment
The reason will be displayed to describe this comment to others. Learn more.
because its just @deprecated
and will be removed soon.
The statements are not true anymore: It is used in Neos Routing to build a URI to a node.
@@ -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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
its just a dummy stub, and _
indicates its unused. the class will be obliterated into nothing.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
we probably dont even need the __toString
anymore at this time ... but i kept it ... it will all go away. Its legacy.
* @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 comment
The reason will be displayed to describe this comment to others. Learn more.
as per my main description:
where previously Node $node was used to trigger property mapping (DataSourceController and WorkspaceController) we now pass the node as string and use the legacy node address factory to handle the legacy format manually. A followup will adjust everything to work with the new node address.
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.
There is one little code suggestion from bwaidelich I would think should be merged, the rest seems fine to me.
Okay in that case id merge it ;) |
Solves: #4873
This is an intermediate step after !!! FEATURE: Overhaul node uri building before we fully move to the new node address serialisation in the Neos Ui.
Everything was refactored here that does not require adjustments in the Neos Ui (and the workspace module was also not really touched).
NodeAddressFactory
is only used at the places where we still depend on the legacy format, but we create already new node address instances viacreateCoreNodeAddressFromLegacyUriString
isInLiveWorkspace
method.Neos.Node.serializedNodeAddress(node)
will return the new node address formatNode $node
was used to trigger property mapping (DataSourceController
andWorkspaceController
) we now pass the node asstring
and use the legacy node address factory to handle the legacy format manually. A followup will adjust everything to work with the new node address.$node
Neos.Workspace.Ui/Classes
with phpstanUpgrade instructions
This change is breaking for existing Neos 9 users as the node being property mapped will require a new serialised input.
In Neos 8.3 you could call this action with the node like
in Neos9-dev it was
and now it must be the node address in json
NodeAddress::toJson()
to build such a uri you can simply use:
Review instructions
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions