getPersonalWorkspace() публичный Метод

Returns the current user's personal workspace or null if no user is logged in
public getPersonalWorkspace ( ) : Workspace
Результат Neos\ContentRepository\Domain\Model\Workspace
 /**
  * Returns an array of usage reference objects.
  *
  * @param AssetInterface $asset
  * @return array<\Neos\Neos\Domain\Model\Dto\AssetUsageInNodeProperties>
  * @throws \Neos\ContentRepository\Exception\NodeConfigurationException
  */
 public function getUsageReferences(AssetInterface $asset)
 {
     $assetIdentifier = $this->persistenceManager->getIdentifierByObject($asset);
     if (isset($this->firstlevelCache[$assetIdentifier])) {
         return $this->firstlevelCache[$assetIdentifier];
     }
     $userWorkspace = $this->userService->getPersonalWorkspace();
     $relatedNodes = [];
     foreach ($this->getRelatedNodes($asset) as $relatedNodeData) {
         $accessible = $this->domainUserService->currentUserCanReadWorkspace($relatedNodeData->getWorkspace());
         if ($accessible) {
             $context = $this->createContextMatchingNodeData($relatedNodeData);
         } else {
             $context = $this->createContentContext($userWorkspace->getName());
         }
         $site = $context->getCurrentSite();
         $node = $this->nodeFactory->createFromNodeData($relatedNodeData, $context);
         $flowQuery = new FlowQuery([$node]);
         /** @var \Neos\ContentRepository\Domain\Model\NodeInterface $documentNode */
         $documentNode = $flowQuery->closest('[instanceof Neos.Neos:Document]')->get(0);
         $relatedNodes[] = new AssetUsageInNodeProperties($asset, $site, $documentNode, $node, $accessible);
     }
     $this->firstlevelCache[$assetIdentifier] = $relatedNodes;
     return $this->firstlevelCache[$assetIdentifier];
 }
 /**
  * @test
  */
 public function getPersonalWorkspaceReturnsTheUsersWorkspaceIfAUserIsLoggedIn()
 {
     $mockUser = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock();
     $mockUserWorkspace = $this->getMockBuilder(Workspace::class)->disableOriginalConstructor()->getMock();
     $this->mockUserDomainService->expects($this->atLeastOnce())->method('getCurrentUser')->will($this->returnValue($mockUser));
     $this->mockUserDomainService->expects($this->atLeastOnce())->method('getUserName')->with($mockUser)->will($this->returnValue('TheUserName'));
     $this->mockWorkspaceRepository->expects($this->atLeastOnce())->method('findOneByName')->with('user-TheUserName')->will($this->returnValue($mockUserWorkspace));
     $this->assertSame($mockUserWorkspace, $this->userService->getPersonalWorkspace());
 }
 /**
  * Get Related Nodes for an asset
  *
  * @param AssetInterface $asset
  * @return void
  */
 public function relatedNodesAction(AssetInterface $asset)
 {
     $userWorkspace = $this->userService->getPersonalWorkspace();
     $usageReferences = $this->assetService->getUsageReferences($asset);
     $relatedNodes = [];
     /** @var AssetUsageInNodeProperties $usage */
     foreach ($usageReferences as $usage) {
         $documentNodeIdentifier = $usage->getDocumentNode() instanceof NodeInterface ? $usage->getDocumentNode()->getIdentifier() : null;
         $relatedNodes[$usage->getSite()->getNodeName()]['site'] = $usage->getSite();
         $relatedNodes[$usage->getSite()->getNodeName()]['documentNodes'][$documentNodeIdentifier]['node'] = $usage->getDocumentNode();
         $relatedNodes[$usage->getSite()->getNodeName()]['documentNodes'][$documentNodeIdentifier]['nodes'][] = ['node' => $usage->getNode(), 'nodeData' => $usage->getNode()->getNodeData(), 'contextDocumentNode' => $usage->getDocumentNode(), 'accessible' => $usage->isAccessible()];
     }
     $this->view->assignMultiple(['asset' => $asset, 'relatedNodes' => $relatedNodes, 'contentDimensions' => $this->contentDimensionPresetSource->getAllPresets(), 'userWorkspace' => $userWorkspace]);
 }