Skip to content

Commit

Permalink
TASK: Adjust to changes in 9.0 (workspace metadata)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Oct 17, 2024
1 parent b072764 commit 64ac4bc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface;
use Neos\Neos\Domain\Workspace\WorkspaceProvider;
use Neos\Neos\Domain\Service\WorkspacePublishingService;
use Neos\Neos\Ui\Application\Shared\ConflictsOccurred;
use Neos\Neos\Ui\Application\Shared\PublishSucceeded;
use Neos\Neos\Ui\Controller\TranslationTrait;
Expand All @@ -41,7 +41,7 @@ final class PublishChangesInDocumentCommandHandler
protected ContentRepositoryRegistry $contentRepositoryRegistry;

#[Flow\Inject]
protected WorkspaceProvider $workspaceProvider;
protected WorkspacePublishingService $workspacePublishingService;

#[Flow\Inject]
protected NodeLabelGeneratorInterface $nodeLabelGenerator;
Expand All @@ -53,15 +53,19 @@ public function handle(
PublishChangesInDocumentCommand $command
): PublishSucceeded|ConflictsOccurred {
try {
$workspace = $this->workspaceProvider->provideForWorkspaceName(
$publishingResult = $this->workspacePublishingService->publishChangesInDocument(
$command->contentRepositoryId,
$command->workspaceName,
$command->documentId
);

$workspace = $this->contentRepositoryRegistry->get($command->contentRepositoryId)->findWorkspaceByName(
$command->workspaceName
);
$publishingResult = $workspace->publishChangesInDocument($command->documentId);

return new PublishSucceeded(
numberOfAffectedChanges: $publishingResult->numberOfPublishedChanges,
baseWorkspaceName: $workspace->getCurrentBaseWorkspaceName()?->value
baseWorkspaceName: $workspace?->baseWorkspaceName?->value
);
} catch (NodeAggregateCurrentlyDoesNotExist $e) {
throw new \RuntimeException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface;
use Neos\Neos\Domain\Workspace\WorkspaceProvider;
use Neos\Neos\Domain\Service\WorkspacePublishingService;
use Neos\Neos\Ui\Application\Shared\ConflictsOccurred;
use Neos\Neos\Ui\Application\Shared\PublishSucceeded;
use Neos\Neos\Ui\Infrastructure\ContentRepository\ConflictsFactory;
Expand All @@ -36,7 +36,7 @@ final class PublishChangesInSiteCommandHandler
protected ContentRepositoryRegistry $contentRepositoryRegistry;

#[Flow\Inject]
protected WorkspaceProvider $workspaceProvider;
protected WorkspacePublishingService $workspacePublishingService;

#[Flow\Inject]
protected NodeLabelGeneratorInterface $nodeLabelGenerator;
Expand All @@ -45,15 +45,19 @@ public function handle(
PublishChangesInSiteCommand $command
): PublishSucceeded|ConflictsOccurred {
try {
$workspace = $this->workspaceProvider->provideForWorkspaceName(
$publishingResult = $this->workspacePublishingService->publishChangesInSite(
$command->contentRepositoryId,
$command->workspaceName,
$command->siteId
);

$workspace = $this->contentRepositoryRegistry->get($command->contentRepositoryId)->findWorkspaceByName(
$command->workspaceName
);
$publishingResult = $workspace->publishChangesInSite($command->siteId);

return new PublishSucceeded(
numberOfAffectedChanges: $publishingResult->numberOfPublishedChanges,
baseWorkspaceName: $workspace->getCurrentBaseWorkspaceName()?->value
baseWorkspaceName: $workspace?->baseWorkspaceName?->value
);
} catch (WorkspaceRebaseFailed $e) {
$conflictsFactory = new ConflictsFactory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface;
use Neos\Neos\Domain\Service\WorkspacePublishingService;
use Neos\Neos\Ui\Application\Shared\ConflictsOccurred;
use Neos\Neos\Ui\Infrastructure\ContentRepository\ConflictsFactory;

/**
* The application layer level command handler to for rebasing the workspace
Expand Down
5 changes: 2 additions & 3 deletions Classes/Infrastructure/ContentRepository/ConflictsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregate;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\Projection\Workspace\Workspace;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeAggregateCurrentlyDoesNotExist;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\Flow\Annotations as Flow;
use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface;
Expand Down Expand Up @@ -70,8 +70,7 @@ public function __construct(
) {
$this->nodeTypeManager = $contentRepository->getNodeTypeManager();

$this->workspace = $contentRepository->getWorkspaceFinder()
->findOneByName($workspaceName);
$this->workspace = $contentRepository->findWorkspaceByName($workspaceName);
}

public function fromWorkspaceRebaseFailed(
Expand Down

0 comments on commit 64ac4bc

Please sign in to comment.