Skip to content

Commit

Permalink
Merge pull request neos#3814 from mhsdesign/task/dont-use-deprected-n…
Browse files Browse the repository at this point in the history
…ode-get-label

TASK: Dont use deprecated `Node::getLabel`
  • Loading branch information
mhsdesign authored Jun 25, 2024
2 parents 1fb0677 + 30720af commit 6b83212
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Classes/Application/SyncWorkspace/Conflicts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
);
Expand Down
4 changes: 3 additions & 1 deletion Classes/Application/SyncWorkspace/ConflictsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -65,6 +66,7 @@ final class ConflictsBuilder

public function __construct(
private ContentRepository $contentRepository,
private NodeLabelGeneratorInterface $nodeLabelGenerator,
private WorkspaceName $workspaceName,
private ?DimensionSpacePoint $preferredDimensionSpacePoint,
) {
Expand Down Expand Up @@ -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)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -33,6 +34,9 @@ final class SyncWorkspaceCommandHandler
#[Flow\Inject]
protected WorkspaceProvider $workspaceProvider;

#[Flow\Inject]
protected NodeLabelGeneratorInterface $nodeLabelGenerator;

public function handle(SyncWorkspaceCommand $command): void
{
try {
Expand All @@ -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
);
Expand Down

0 comments on commit 6b83212

Please sign in to comment.