diff --git a/Classes/Application/PublishChangesInDocument/PublishChangesInDocumentCommandHandler.php b/Classes/Application/PublishChangesInDocument/PublishChangesInDocumentCommandHandler.php index 9e89d1993b..d090fdb815 100644 --- a/Classes/Application/PublishChangesInDocument/PublishChangesInDocumentCommandHandler.php +++ b/Classes/Application/PublishChangesInDocument/PublishChangesInDocumentCommandHandler.php @@ -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; @@ -41,7 +41,7 @@ final class PublishChangesInDocumentCommandHandler protected ContentRepositoryRegistry $contentRepositoryRegistry; #[Flow\Inject] - protected WorkspaceProvider $workspaceProvider; + protected WorkspacePublishingService $workspacePublishingService; #[Flow\Inject] protected NodeLabelGeneratorInterface $nodeLabelGenerator; @@ -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( diff --git a/Classes/Application/PublishChangesInSite/PublishChangesInSiteCommandHandler.php b/Classes/Application/PublishChangesInSite/PublishChangesInSiteCommandHandler.php index b7d8a2e792..2326a5cadb 100644 --- a/Classes/Application/PublishChangesInSite/PublishChangesInSiteCommandHandler.php +++ b/Classes/Application/PublishChangesInSite/PublishChangesInSiteCommandHandler.php @@ -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; @@ -36,7 +36,7 @@ final class PublishChangesInSiteCommandHandler protected ContentRepositoryRegistry $contentRepositoryRegistry; #[Flow\Inject] - protected WorkspaceProvider $workspaceProvider; + protected WorkspacePublishingService $workspacePublishingService; #[Flow\Inject] protected NodeLabelGeneratorInterface $nodeLabelGenerator; @@ -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( diff --git a/Classes/Application/SyncWorkspace/SyncWorkspaceCommandHandler.php b/Classes/Application/SyncWorkspace/SyncWorkspaceCommandHandler.php index 310ebdcfa6..3539ee95d7 100644 --- a/Classes/Application/SyncWorkspace/SyncWorkspaceCommandHandler.php +++ b/Classes/Application/SyncWorkspace/SyncWorkspaceCommandHandler.php @@ -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 diff --git a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php index 46b6a4283d..fb688ef00e 100644 --- a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php +++ b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php @@ -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; @@ -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(