From 30720af24bf10f68d22fc61f9eb29e0d50cd735b Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 24 Jun 2024 22:01:24 +0200 Subject: [PATCH] TASK: Dont use deprecated `Node::getLabel` --- Classes/Application/SyncWorkspace/Conflicts.php | 3 +++ Classes/Application/SyncWorkspace/ConflictsBuilder.php | 4 +++- .../SyncWorkspace/SyncWorkspaceCommandHandler.php | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Classes/Application/SyncWorkspace/Conflicts.php b/Classes/Application/SyncWorkspace/Conflicts.php index 06382b9b13..e53c5ef9e3 100644 --- a/Classes/Application/SyncWorkspace/Conflicts.php +++ b/Classes/Application/SyncWorkspace/Conflicts.php @@ -18,6 +18,7 @@ use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\Flow\Annotations as Flow; +use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; /** * @internal for communication within the Neos UI only @@ -35,11 +36,13 @@ public function __construct(Conflict ...$items) public static function builder( ContentRepository $contentRepository, + NodeLabelGeneratorInterface $nodeLabelGenerator, WorkspaceName $workspaceName, ?DimensionSpacePoint $preferredDimensionSpacePoint, ): ConflictsBuilder { return new ConflictsBuilder( contentRepository: $contentRepository, + nodeLabelGenerator: $nodeLabelGenerator, workspaceName: $workspaceName, preferredDimensionSpacePoint: $preferredDimensionSpacePoint ); diff --git a/Classes/Application/SyncWorkspace/ConflictsBuilder.php b/Classes/Application/SyncWorkspace/ConflictsBuilder.php index 12fbc046a8..19a4449914 100644 --- a/Classes/Application/SyncWorkspace/ConflictsBuilder.php +++ b/Classes/Application/SyncWorkspace/ConflictsBuilder.php @@ -43,6 +43,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\Flow\Annotations as Flow; +use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; use Neos\Neos\Domain\Service\NodeTypeNameFactory; /** @@ -65,6 +66,7 @@ final class ConflictsBuilder public function __construct( private ContentRepository $contentRepository, + private NodeLabelGeneratorInterface $nodeLabelGenerator, private WorkspaceName $workspaceName, private ?DimensionSpacePoint $preferredDimensionSpacePoint, ) { @@ -248,7 +250,7 @@ private function createIconLabelForNode(Node $node): IconLabel return new IconLabel( icon: $nodeType?->getConfiguration('ui.icon') ?? 'questionmark', - label: $node->getLabel() + label: $this->nodeLabelGenerator->getLabel($node) ); } diff --git a/Classes/Application/SyncWorkspace/SyncWorkspaceCommandHandler.php b/Classes/Application/SyncWorkspace/SyncWorkspaceCommandHandler.php index 9595e2a46f..834837747e 100644 --- a/Classes/Application/SyncWorkspace/SyncWorkspaceCommandHandler.php +++ b/Classes/Application/SyncWorkspace/SyncWorkspaceCommandHandler.php @@ -17,6 +17,7 @@ use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Exception\WorkspaceRebaseFailed; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; +use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; use Neos\Neos\Domain\Workspace\WorkspaceProvider; /** @@ -33,6 +34,9 @@ final class SyncWorkspaceCommandHandler #[Flow\Inject] protected WorkspaceProvider $workspaceProvider; + #[Flow\Inject] + protected NodeLabelGeneratorInterface $nodeLabelGenerator; + public function handle(SyncWorkspaceCommand $command): void { try { @@ -46,6 +50,7 @@ public function handle(SyncWorkspaceCommand $command): void $conflictsBuilder = Conflicts::builder( contentRepository: $this->contentRepositoryRegistry ->get($command->contentRepositoryId), + nodeLabelGenerator: $this->nodeLabelGenerator, workspaceName: $command->workspaceName, preferredDimensionSpacePoint: $command->preferredDimensionSpacePoint );