diff --git a/config/set/contentrepository-90.php b/config/set/contentrepository-90.php index a1a6ee8..743acbf 100644 --- a/config/set/contentrepository-90.php +++ b/config/set/contentrepository-90.php @@ -123,7 +123,7 @@ \Neos\ContentRepository\Domain\Model\NodeType::class => \Neos\ContentRepository\Core\NodeType\NodeType::class, \Neos\ContentRepository\Domain\Service\NodeTypeManager::class => \Neos\ContentRepository\Core\NodeType\NodeTypeManager::class, - \Neos\ContentRepository\Domain\Model\Workspace::class => \Neos\ContentRepository\Core\Projection\Workspace\Workspace::class, + \Neos\ContentRepository\Domain\Model\Workspace::class => \Neos\ContentRepository\Core\SharedModel\Workspace\Workspace::class, \Neos\ContentRepository\Domain\NodeAggregate\NodeAggregateIdentifier::class => \Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId::class, \Neos\ContentRepository\Domain\NodeAggregate\NodeName::class => \Neos\ContentRepository\Core\SharedModel\Node\NodeName::class, \Neos\ContentRepository\Domain\NodeType\NodeTypeName::class => \Neos\ContentRepository\Core\NodeType\NodeTypeName::class, @@ -695,6 +695,42 @@ */ $rectorConfig->rule(FusionFlowQueryContextRector::class); + /** + * \Neos\ContentRepository\Domain\Model\Workspace + */ + // getBaseWorkspace(): Workspace|null + //->baseworkspaceName + // getBaseWorkspaces(): Workspace[] + // -> + // getDescription(): null|string + // workspaceService->getWorkspaceMetadata->description->value + // getName(): string + // ->name + // getNodeCount(): int + $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'getNodeCount', '!! Workspace::getNodeCount() has been removed in Neos 9.0 without a replacement.'); + // getOwner(): UserInterface|null + // getRootNodeData(): NodeData + $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'getRootNodeData', '!! Workspace::getRootNodeData() has been removed in Neos 9.0 without a replacement.'); + // getTitle(): string + // meta->setWorkspaceTitle + // isInternalWorkspace(): bool + $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isInternalWorkspace', '!! Workspace::isInternalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()'); + // isPersonalWorkspace(): bool + $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isPersonalWorkspace', '!! Workspace::isPersonalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()'); + // isPrivateWorkspace(): bool + $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isPrivateWorkspace', '!! Workspace::isPrivateWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()'); + // isPublicWorkspace(): bool + $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isPublicWorkspace', '!! Workspace::isPublicWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()'); + // publish(targetWorkspace: Workspace): void + // publishNode(nodeToPublish: NodeInterface, targetWorkspace: Workspace): void + // publishNodes(nodes: NodeInterface[], targetWorkspace: Workspace): void + // setBaseWorkspace(baseWorkspace: Workspace): void + // setDescription(description: string): void + // workspaceService->setWorkspaceDescription + // setOwner(user: UserInterface|null|string): void + // setTitle(title: string): void + // workspaceService->setWorkspaceTitle + /** * SPECIAL rules */ diff --git a/tests/Sets/ContentRepository90/Fixture/Signals/Workspace.php.inc b/tests/Sets/ContentRepository90/Fixture/Signals/Workspace.php.inc index 6969765..e75214c 100644 --- a/tests/Sets/ContentRepository90/Fixture/Signals/Workspace.php.inc +++ b/tests/Sets/ContentRepository90/Fixture/Signals/Workspace.php.inc @@ -46,12 +46,12 @@ class Package extends BasePackage // TODO 9.0 migration: The signal "baseWorkspaceChanged" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal. - $dispatcher->connect(\Neos\ContentRepository\Core\Projection\Workspace\Workspace::class, 'baseWorkspaceChanged', function () { return 'foo'; }); + $dispatcher->connect(\Neos\ContentRepository\Core\SharedModel\Workspace\Workspace::class, 'baseWorkspaceChanged', function () { return 'foo'; }); // TODO 9.0 migration: The signal "beforeNodePublishing" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal. $dispatcher->connect('Neos\ContentRepository\Domain\Model\Workspace', 'beforeNodePublishing', RouterCachingService::class, 'flushCaches'); // TODO 9.0 migration: The signal "afterNodePublishing" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal. - $dispatcher->connect(\Neos\ContentRepository\Core\Projection\Workspace\Workspace::class, 'afterNodePublishing', function () { return 'foo'; }); + $dispatcher->connect(\Neos\ContentRepository\Core\SharedModel\Workspace\Workspace::class, 'afterNodePublishing', function () { return 'foo'; }); } } diff --git a/tests/Sets/ContentRepository90/Fixture/workspace.php.inc b/tests/Sets/ContentRepository90/Fixture/workspace.php.inc new file mode 100644 index 0000000..e71baba --- /dev/null +++ b/tests/Sets/ContentRepository90/Fixture/workspace.php.inc @@ -0,0 +1,127 @@ +getBaseWorkspace(); + + $baseWorkspaces = $workspace->getBaseWorkspaces(); + + $title = $workspace->getTitle(); + + $description = $workspace->getDescription(); + + $name = $workspace->getName(); + + $workspace->getNodeCount(); + + $workspace->getOwner(); + + $workspace->getRootNodeData(); + + $workspace->isInternalWorkspace(); + + $workspace->isPersonalWorkspace(); + + $workspace->isPrivateWorkspace(); + + $workspace->isPublicWorkspace(); + + $workspace->publish($targetWorkspace); + + $workspace->publishNode($node, $targetWorkspace); + + $workspace->publishNodes([$node], $targetWorkspace); + + $workspace->setBaseWorkspace($baseWorkspace); + + $workspace->setOwner($user); + + $workspace->setDescription("description"); + + $workspace->setTitle("title"); + } +} +----- + + +namespace Neos\Rector\Test; + +use Neos\Flow\Annotations as Flow; + +class SomeClass extends AnotherClass +{ + #[Flow\Inject] + protected \Neos\Neos\Domain\Service\WorkspaceService $workspaceService; + #[Flow\Inject] + protected \Neos\ContentRepositoryRegistry\ContentRepositoryRegistry $contentRepositoryRegistry; + #[Flow\Inject] + protected \Neos\Neos\Domain\Service\WorkspacePublishingService $workspacePublishingService; + + public function test(\Neos\ContentRepository\Core\SharedModel\Workspace\Workspace $workspace) + { + + $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default')); + $baseWorkspace = $contentRepository->findWorkspaceByName($workspace->baseWorkspaceName); + + $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default')); + $baseWorkspaces = $contentRepository->findWorkspaces()->getBaseWorkspaces($workspace->baseWorkspaceName); + + $title = $this->workspaceService->getWorkspaceMetadata(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName)->title; + + $description = $this->workspaceService->getWorkspaceMetadata(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName)->description; + // TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead. + + + $name = $workspace->workspaceName->value; + // TODO 9.0 migration: !! Workspace::getNodeCount() has been removed in Neos 9.0 without a replacement. + + + $workspace->getNodeCount(); + + $workspace->getOwner(); + // TODO 9.0 migration: !! Workspace::getRootNodeData() has been removed in Neos 9.0 without a replacement. + + + $workspace->getRootNodeData(); + // TODO 9.0 migration: !! Workspace::isInternalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions() + + + $workspace->isInternalWorkspace(); + // TODO 9.0 migration: !! Workspace::isPersonalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions() + + + $workspace->isPersonalWorkspace(); + // TODO 9.0 migration: !! Workspace::isPrivateWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions() + + + $workspace->isPrivateWorkspace(); + // TODO 9.0 migration: !! Workspace::isPublicWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions() + + + $workspace->isPublicWorkspace(); + + $this->workspacePublishingService->publishWorkspace(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName); + + // TODO: Check if this matches your requirements as this is not a 100% replacement + $this->workspacePublishingService->publishChangesInDocument(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, $node); + + // TODO: Use the \Neos\Neos\Domain\Service\WorkspacePublishingService to publish a workspace or changesin a document. + $workspace->publishNodes([$node], $targetWorkspace); + + + $workspace->setBaseWorkspace($baseWorkspace); + $workspace->setOwner($user); + + $this->workspaceService->setWorkspaceDescription(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, 'description'); + + $this->workspaceService->setWorkspaceTitle(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, 'title'); + } +}