当前位置: 首页>>代码示例>>PHP>>正文


PHP WorkspaceRepository::findOneByName方法代码示例

本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Repository\WorkspaceRepository::findOneByName方法的典型用法代码示例。如果您正苦于以下问题:PHP WorkspaceRepository::findOneByName方法的具体用法?PHP WorkspaceRepository::findOneByName怎么用?PHP WorkspaceRepository::findOneByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\TYPO3CR\Domain\Repository\WorkspaceRepository的用法示例。


在下文中一共展示了WorkspaceRepository::findOneByName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPersonalWorkspace

 /**
  * Returns the current user's personal workspace or null if no user is logged in
  *
  * @return Workspace
  * @api
  */
 public function getPersonalWorkspace()
 {
     $workspaceName = $this->getPersonalWorkspaceName();
     if ($workspaceName !== null) {
         return $this->workspaceRepository->findOneByName($this->getPersonalWorkspaceName());
     }
 }
开发者ID:cognifloyd,项目名称:neos-development-collection,代码行数:13,代码来源:UserService.php

示例2: publishWorkspaceAction

 /**
  * Publishes the whole workspace
  *
  * @param Workspace $workspace
  * @return void
  */
 public function publishWorkspaceAction(Workspace $workspace)
 {
     $liveWorkspace = $this->workspaceRepository->findOneByName('live');
     $workspace->publish($liveWorkspace);
     $this->addFlashMessage('Changes in workspace "%s" have been published', 'Changes published', Message::SEVERITY_OK, array($workspace->getName()), 1412420808);
     $this->redirect('index');
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:13,代码来源:WorkspacesController.php

示例3: createContext

 /**
  * @return \TYPO3\TYPO3CR\Domain\Service\Context
  */
 protected function createContext()
 {
     $workspace = $this->workspaceRepository->findOneByName('live');
     if ($workspace === null) {
         $this->workspaceRepository->add(new Workspace('live'));
     }
     $this->persistenceManager->persistAll();
     return $this->contextFactory->create(array('workspaceName' => 'live', 'invisibleContentShown' => true, 'inaccessibleContentShown' => true));
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:12,代码来源:LegacySiteImportService.php

示例4: publishWorkspaceAction

 /**
  * Publishes the whole workspace
  *
  * @param Workspace $workspace
  * @return void
  */
 public function publishWorkspaceAction(Workspace $workspace)
 {
     if (($targetWorkspace = $workspace->getBaseWorkspace()) === null) {
         $targetWorkspace = $this->workspaceRepository->findOneByName('live');
     }
     $workspace->publish($targetWorkspace);
     $this->addFlashMessage($this->translator->translateById('workspaces.allChangesInWorkspaceHaveBeenPublished', [htmlspecialchars($workspace->getTitle()), htmlspecialchars($targetWorkspace->getTitle())], null, null, 'Modules', 'TYPO3.Neos'));
     $this->redirect('index');
 }
开发者ID:BlueM,项目名称:neos-development-collection,代码行数:15,代码来源:WorkspacesController.php

示例5: importFromFile

 /**
  * Imports one or multiple sites from the XML file at $pathAndFilename
  *
  * @param string $pathAndFilename
  * @return Site The imported site
  * @throws UnknownPackageException|InvalidPackageStateException|NeosException
  */
 public function importFromFile($pathAndFilename)
 {
     /** @var Site $importedSite */
     $site = NULL;
     $this->eventEmittingService->withoutEventLog(function () use($pathAndFilename, &$site) {
         $xmlReader = new \XMLReader();
         $xmlReader->open($pathAndFilename, NULL, LIBXML_PARSEHUGE);
         if ($this->workspaceRepository->findOneByName('live') === NULL) {
             $this->workspaceRepository->add(new Workspace('live'));
         }
         $rootNode = $this->contextFactory->create()->getRootNode();
         $this->persistenceManager->persistAll();
         $sitesNode = $rootNode->getNode('/sites');
         if ($sitesNode === NULL) {
             $sitesNode = $rootNode->createSingleNode('sites');
         }
         while ($xmlReader->read()) {
             if ($xmlReader->nodeType != \XMLReader::ELEMENT || $xmlReader->name !== 'site') {
                 continue;
             }
             $isLegacyFormat = $xmlReader->getAttribute('nodeName') !== NULL && $xmlReader->getAttribute('state') === NULL && $xmlReader->getAttribute('siteResourcesPackageKey') === NULL;
             if ($isLegacyFormat) {
                 $site = $this->legacySiteImportService->importSitesFromFile($pathAndFilename);
                 return;
             }
             $site = $this->getSiteByNodeName($xmlReader->getAttribute('siteNodeName'));
             $site->setName($xmlReader->getAttribute('name'));
             $site->setState((int) $xmlReader->getAttribute('state'));
             $siteResourcesPackageKey = $xmlReader->getAttribute('siteResourcesPackageKey');
             if (!$this->packageManager->isPackageAvailable($siteResourcesPackageKey)) {
                 throw new UnknownPackageException(sprintf('Package "%s" specified in the XML as site resources package does not exist.', $siteResourcesPackageKey), 1303891443);
             }
             if (!$this->packageManager->isPackageActive($siteResourcesPackageKey)) {
                 throw new InvalidPackageStateException(sprintf('Package "%s" specified in the XML as site resources package is not active.', $siteResourcesPackageKey), 1303898135);
             }
             $site->setSiteResourcesPackageKey($siteResourcesPackageKey);
             $rootNode = $this->contextFactory->create()->getRootNode();
             // We fetch the workspace to be sure it's known to the persistence manager and persist all
             // so the workspace and site node are persisted before we import any nodes to it.
             $rootNode->getContext()->getWorkspace();
             $this->persistenceManager->persistAll();
             $sitesNode = $rootNode->getNode('/sites');
             if ($sitesNode === NULL) {
                 $sitesNode = $rootNode->createNode('sites');
             }
             $this->nodeImportService->import($xmlReader, $sitesNode->getPath(), dirname($pathAndFilename) . '/Resources');
         }
     });
     if ($site === NULL) {
         throw new NeosException(sprintf('The XML file did not contain a valid site node.'), 1418999522);
     }
     $this->emitSiteImported($site);
     return $site;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:61,代码来源:SiteImportService.php

示例6: publishAllAction

 /**
  * Publish everything in the workspace with the given workspace name
  *
  * @param string $sourceWorkspaceName Name of the source workspace containing the content to publish
  * @param string $targetWorkspaceName Name of the target workspace the content should be published to
  * @return void
  */
 public function publishAllAction($sourceWorkspaceName, $targetWorkspaceName)
 {
     $sourceWorkspace = $this->workspaceRepository->findOneByName($sourceWorkspaceName);
     $targetWorkspace = $this->workspaceRepository->findOneByName($targetWorkspaceName);
     if ($sourceWorkspace === null) {
         $this->throwStatus(400, 'Invalid source workspace');
     }
     if ($targetWorkspace === null) {
         $this->throwStatus(400, 'Invalid target workspace');
     }
     $this->publishingService->publishNodes($this->publishingService->getUnpublishedNodes($sourceWorkspace), $targetWorkspace);
     $this->throwStatus(204, sprintf('All changes in workspace %s have been published to %s', $sourceWorkspaceName, $targetWorkspaceName), '');
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:20,代码来源:WorkspaceController.php

示例7: createWorkspaceAndRootNodeIfNecessary

 /**
  * If the specified workspace or its root node does not exist yet, the workspace and root node will be created.
  *
  * This method is basically a safeguard for legacy and potentially broken websites where users might not have
  * their own workspace yet. In a normal setup, the Domain User Service is responsible for creating and deleting
  * user workspaces.
  *
  * @param string $workspaceName Name of the workspace
  * @return void
  */
 protected function createWorkspaceAndRootNodeIfNecessary($workspaceName)
 {
     $workspace = $this->workspaceRepository->findOneByName($workspaceName);
     if ($workspace === NULL) {
         $liveWorkspace = $this->workspaceRepository->findOneByName('live');
         $workspace = new Workspace($workspaceName, $liveWorkspace);
         $this->workspaceRepository->add($workspace);
         $this->persistenceManager->whitelistObject($workspace);
     }
     $contentContext = $this->createContext($workspaceName);
     $rootNode = $contentContext->getRootNode();
     $this->persistenceManager->whitelistObject($rootNode);
     $this->persistenceManager->whitelistObject($rootNode->getNodeData());
     $this->persistenceManager->persistAll(TRUE);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:25,代码来源:BackendRedirectionService.php

示例8: createWorkspaceAndRootNodeIfNecessary

 /**
  * If the specified workspace or its root node does not exist yet, the workspace and root node will be created.
  *
  * This method is basically a safeguard for legacy and potentially broken websites where users might not have
  * their own workspace yet. In a normal setup, the Domain User Service is responsible for creating and deleting
  * user workspaces.
  *
  * @param string $workspaceName Name of the workspace
  * @return void
  */
 protected function createWorkspaceAndRootNodeIfNecessary($workspaceName)
 {
     $workspace = $this->workspaceRepository->findOneByName($workspaceName);
     if ($workspace === null) {
         $liveWorkspace = $this->workspaceRepository->findOneByName('live');
         $owner = $this->userService->getBackendUser();
         $workspace = new Workspace($workspaceName, $liveWorkspace, $owner);
         $this->workspaceRepository->add($workspace);
         $this->persistenceManager->whitelistObject($workspace);
     }
     $contentContext = $this->createContext($workspaceName);
     $rootNode = $contentContext->getRootNode();
     $this->persistenceManager->whitelistObject($rootNode);
     $this->persistenceManager->whitelistObject($rootNode->getNodeData());
     $this->persistenceManager->persistAll(true);
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:26,代码来源:BackendRedirectionService.php

示例9: rebaseCommand

 /**
  * Rebase a workspace
  *
  * This command sets a new base workspace for the specified workspace. Note that doing so will put the possible
  * changes contained in the workspace to be rebased into a different context and thus might lead to unintended
  * results when being published.
  *
  * @param string $workspace Name of the workspace to rebase, for example "user-john"
  * @param string $baseWorkspace Name of the new base workspace
  * @return void
  */
 public function rebaseCommand($workspace, $baseWorkspace)
 {
     $workspaceName = $workspace;
     $workspace = $this->workspaceRepository->findOneByName($workspaceName);
     if (!$workspace instanceof Workspace) {
         $this->outputLine('Workspace "%s" does not exist', array($workspaceName));
         $this->quit(1);
     }
     $baseWorkspaceName = $baseWorkspace;
     $baseWorkspace = $this->workspaceRepository->findOneByName($baseWorkspaceName);
     if (!$baseWorkspace instanceof Workspace) {
         $this->outputLine('The base workspace "%s" does not exist', array($baseWorkspaceName));
         $this->quit(2);
     }
     $workspace->setBaseWorkspace($baseWorkspace);
     $this->workspaceRepository->update($workspace);
     $this->outputLine('Set "%s" as the new base workspace for "%s".', array($baseWorkspaceName, $workspaceName));
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:29,代码来源:WorkspaceCommandController.php

示例10: changedNodeCanBePublishedFromPersonalToLiveWorkspace

 /**
  * @test
  */
 public function changedNodeCanBePublishedFromPersonalToLiveWorkspace()
 {
     $liveContext = $this->contextFactory->create(array('workspaceName' => 'live'));
     $liveContext->getRootNode()->createNode('homepage')->createNode('teaser')->createNode('node52697bdfee199');
     $teaserNode = $this->rootNode->getNode('/homepage/teaser/node52697bdfee199');
     $teaserNode->setProperty('text', 'Updated text!');
     $this->saveNodesAndTearDownRootNodeAndRepository();
     $this->setUpRootNodeAndRepository();
     $this->liveWorkspace = $this->workspaceRepository->findOneByName('live');
     $teaserNode = $this->rootNode->getNode('/homepage/teaser/node52697bdfee199');
     $this->rootNode->getWorkspace()->publishNode($teaserNode, $this->liveWorkspace);
     $this->saveNodesAndTearDownRootNodeAndRepository();
     $this->setUpRootNodeAndRepository();
     $liveContext = $this->contextFactory->create(array('workspaceName' => 'live'));
     $liveRootNode = $liveContext->getRootNode();
     $teaserNode = $liveRootNode->getNode('/homepage/teaser/node52697bdfee199');
     $this->assertInstanceOf('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface', $teaserNode);
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:21,代码来源:WorkspacesTest.php

示例11: publishAction

 /**
  * Publish nodes
  *
  * @param array $nodeContextPaths
  * @param string $targetWorkspaceName
  * @return void
  */
 public function publishAction(array $nodeContextPaths, $targetWorkspaceName)
 {
     try {
         $targetWorkspace = $this->workspaceRepository->findOneByName($targetWorkspaceName);
         foreach ($nodeContextPaths as $contextPath) {
             $node = $this->nodeService->getNodeFromContextPath($contextPath);
             $this->publishingService->publishNode($node, $targetWorkspace);
         }
         $success = new Success();
         $success->setMessage(sprintf('Published %d change(s) to %s.', count($nodeContextPaths), $targetWorkspaceName));
         $this->updateWorkspaceInfo($nodeContextPaths[0]);
         $this->feedbackCollection->add($success);
         $this->persistenceManager->persistAll();
     } catch (\Exception $e) {
         $error = new Error();
         $error->setMessage($e->getMessage());
         $this->feedbackCollection->add($error);
     }
     $this->view->assign('value', $this->feedbackCollection);
 }
开发者ID:neos,项目名称:neos-ui,代码行数:27,代码来源:BackendServiceController.php

示例12: getWorkspace

 /**
  * Returns the current workspace.
  *
  * @param boolean $createWorkspaceIfNecessary If enabled, creates a workspace with the configured name if it doesn't exist already
  * @return \TYPO3\TYPO3CR\Domain\Model\Workspace The workspace or NULL
  * @api
  */
 public function getWorkspace($createWorkspaceIfNecessary = TRUE)
 {
     if ($this->workspace === NULL) {
         $this->workspace = $this->workspaceRepository->findOneByName($this->workspaceName);
         if (!$this->workspace) {
             if ($createWorkspaceIfNecessary === FALSE) {
                 return NULL;
             }
             $liveWorkspace = $this->workspaceRepository->findOneByName('live');
             if (!$liveWorkspace) {
                 $liveWorkspace = new \TYPO3\TYPO3CR\Domain\Model\Workspace('live');
                 $this->workspaceRepository->add($liveWorkspace);
             }
             if ($this->workspaceName === 'live') {
                 $this->workspace = $liveWorkspace;
             } else {
                 $this->workspace = new \TYPO3\TYPO3CR\Domain\Model\Workspace($this->workspaceName, $liveWorkspace);
                 $this->workspaceRepository->add($this->workspace);
             }
         }
     }
     return $this->workspace;
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:30,代码来源:Context.php

示例13: getUserWorkspace

 /**
  * Returns the Workspace of the currently logged in user or NULL if no matching workspace was found.
  * If no user is logged in this returns the live workspace
  *
  * @return Workspace
  */
 public function getUserWorkspace()
 {
     return $this->workspaceRepository->findOneByName($this->getUserWorkspaceName());
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:10,代码来源:UserService.php

示例14: publishWorkspace

 /**
  * @param string $workspaceName
  * @param string $targetWorkspaceName
  * @return void
  */
 public function publishWorkspace($workspaceName, $targetWorkspaceName = 'live')
 {
     $this->workspaceRepository->findOneByName($workspaceName)->publish($targetWorkspaceName);
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3,代码行数:9,代码来源:WorkspacesService.php


注:本文中的TYPO3\TYPO3CR\Domain\Repository\WorkspaceRepository::findOneByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。