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


PHP SiteRepository::update方法代码示例

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


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

示例1: deactivateSiteAction

 /**
  * Deactivates a site
  *
  * @param Site $site Site to deactivate
  * @return void
  */
 public function deactivateSiteAction(Site $site)
 {
     $site->setState($site::STATE_OFFLINE);
     $this->siteRepository->update($site);
     $this->addFlashMessage('The site "%s" has been deactivated.', 'Site deactivated', Message::SEVERITY_OK, array(htmlspecialchars($site->getName())), 1412372975);
     $this->unsetLastVisitedNodeAndRedirect('index');
 }
开发者ID:sbruggmann,项目名称:neos-development-collection,代码行数:13,代码来源:SitesController.php

示例2: deleteAssetCollectionAction

 /**
  * @param AssetCollection $assetCollection
  * @return void
  */
 public function deleteAssetCollectionAction(AssetCollection $assetCollection)
 {
     foreach ($this->siteRepository->findByAssetCollection($assetCollection) as $site) {
         $site->setAssetCollection(null);
         $this->siteRepository->update($site);
     }
     parent::deleteAssetCollectionAction($assetCollection);
 }
开发者ID:aertmann,项目名称:neos-development-collection,代码行数:12,代码来源:AssetController.php

示例3: pruneSite

 /**
  * Remove given site all nodes for that site and all domains associated.
  *
  * @param Site $site
  * @return void
  */
 public function pruneSite(Site $site)
 {
     $siteNodePath = NodePaths::addNodePathSegment(static::SITES_ROOT_PATH, $site->getNodeName());
     $this->nodeDataRepository->removeAllInPath($siteNodePath);
     $siteNodes = $this->nodeDataRepository->findByPath($siteNodePath);
     foreach ($siteNodes as $siteNode) {
         $this->nodeDataRepository->remove($siteNode);
     }
     $site->setPrimaryDomain(null);
     $this->siteRepository->update($site);
     $domainsForSite = $this->domainRepository->findBySite($site);
     foreach ($domainsForSite as $domain) {
         $this->domainRepository->remove($domain);
     }
     $this->persistenceManager->persistAll();
     $this->siteRepository->remove($site);
     $this->emitSitePruned($site);
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:24,代码来源:SiteService.php

示例4: getSiteByNodeName

 /**
  * Updates or creates a site with the given $siteNodeName
  *
  * @param string $siteNodeName
  * @return Site
  */
 protected function getSiteByNodeName($siteNodeName)
 {
     $site = $this->siteRepository->findOneByNodeName($siteNodeName);
     if ($site === null) {
         $site = new Site($siteNodeName);
         $this->siteRepository->add($site);
         return $site;
     }
     $this->siteRepository->update($site);
     return $site;
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:17,代码来源:LegacySiteImportService.php

示例5: deleteDomainAction

 /**
  * Deletes a domain attached to a site
  *
  * @param Domain $domain A domain to delete
  * @Flow\IgnoreValidation("$domain")
  * @return void
  */
 public function deleteDomainAction(Domain $domain)
 {
     $site = $domain->getSite();
     if ($site->getPrimaryDomain() === $domain) {
         $site->setPrimaryDomain(null);
         $this->siteRepository->update($site);
     }
     $this->domainRepository->remove($domain);
     $this->addFlashMessage('The domain "%s" has been deleted.', 'Domain deleted', Message::SEVERITY_OK, array(htmlspecialchars($domain)), 1412373310);
     $this->unsetLastVisitedNodeAndRedirect('edit', null, null, array('site' => $site));
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:18,代码来源:SitesController.php

示例6: deactivateCommand

 /**
  * Deactivate a site
  *
  * This command deactivates the specified site.
  *
  * @param string $siteNode The node name of the site to deactivate
  * @return void
  */
 public function deactivateCommand($siteNode)
 {
     $site = $this->siteRepository->findOneByNodeName($siteNode);
     if (!$site instanceof Site) {
         $this->outputLine('<error>Site not found.</error>');
         $this->quit(1);
     }
     $site->setState(Site::STATE_OFFLINE);
     $this->siteRepository->update($site);
     $this->outputLine('Site deactivated.');
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:19,代码来源:SiteCommandController.php

示例7: importBundle


//.........这里部分代码省略.........
 {
     $nodeTypes = array('page' => $this->nodeTypeManager->getNodeType($this->bundleConfiguration['nodeTypes']['page']), 'section' => $this->nodeTypeManager->getNodeType($this->bundleConfiguration['nodeTypes']['section']), 'text' => $this->nodeTypeManager->getNodeType($this->bundleConfiguration['nodeTypes']['text']));
     $this->outputLine('Importing bundle "%s"', array($bundle));
     $renderedDocumentationRootPath = rtrim($this->bundleConfiguration['renderedDocumentationRootPath'], '/');
     $importRootNode = $this->siteNode->getNode($this->bundleConfiguration['importRootNodePath']);
     if ($importRootNode === NULL) {
         $this->output('ImportRootNode "%s" does not exist!', array($this->bundleConfiguration['importRootNodePath']));
         $this->quit(1);
     }
     if (!is_dir($renderedDocumentationRootPath)) {
         $this->outputLine('The folder "%s" does not exist. Did you render the documentation?', array($renderedDocumentationRootPath));
         $this->quit(1);
     }
     $unorderedJsonFileNames = Files::readDirectoryRecursively($renderedDocumentationRootPath, '.fjson');
     if ($unorderedJsonFileNames === array()) {
         $this->outputLine('The folder "%s" contains no fjson files. Did you render the documentation?', array($renderedDocumentationRootPath));
         $this->quit(1);
     }
     $orderedNodePaths = array();
     foreach ($unorderedJsonFileNames as $jsonPathAndFileName) {
         if (basename($jsonPathAndFileName) === 'Index.fjson') {
             $chapterRelativeNodePath = substr($jsonPathAndFileName, strlen($renderedDocumentationRootPath), -12) . '/';
             $indexArray = json_decode(file_get_contents($jsonPathAndFileName), TRUE);
             foreach (explode(chr(10), $indexArray['body']) as $tocHtmlLine) {
                 preg_match('!^\\<li class="toctree-l1"\\>\\<a class="reference internal" href="\\.\\./([a-zA-Z0-9-]+)/.*$!', $tocHtmlLine, $matches);
                 if ($matches !== array()) {
                     $orderedNodePaths[] = $this->normalizeNodePath($chapterRelativeNodePath . $matches[1]);
                 }
             }
         }
     }
     foreach ($unorderedJsonFileNames as $jsonPathAndFileName) {
         $data = json_decode(file_get_contents($jsonPathAndFileName));
         if (!isset($data->body)) {
             continue;
         }
         $relativeNodePath = substr($jsonPathAndFileName, strlen($renderedDocumentationRootPath) + 1, -6);
         $relativeNodePath = $this->normalizeNodePath($relativeNodePath);
         $segments = explode('/', $relativeNodePath);
         $pageNode = $importRootNode;
         while ($segment = array_shift($segments)) {
             $nodeName = preg_replace('/[^a-z0-9\\-]/', '', $segment);
             $subPageNode = $pageNode->getNode($nodeName);
             if ($subPageNode === NULL) {
                 $this->outputLine('Creating page node "%s"', array($relativeNodePath));
                 /** @var NodeInterface $subPageNode */
                 $subPageNode = $pageNode->createNode($nodeName, $nodeTypes['page']);
                 if (!$subPageNode->hasProperty('title')) {
                     $subPageNode->setProperty('title', $nodeName);
                 }
             } else {
                 $subPageNode->setNodeType($nodeTypes['page']);
             }
             $pageNode = $subPageNode;
         }
         $sectionNode = $pageNode->getNode('main');
         if ($sectionNode === NULL) {
             $this->outputLine('Creating section node "%s"', array($relativeNodePath . '/main'));
             $sectionNode = $pageNode->createNode('main', $nodeTypes['section']);
         } else {
             $sectionNode->setNodeType($nodeTypes['section']);
         }
         $textNode = $sectionNode->getNode('text1');
         if ($textNode === NULL) {
             $this->outputLine('Creating text node "%s"', array($relativeNodePath . '/main/text1'));
             $textNode = $sectionNode->createNode('text1', $nodeTypes['text']);
         } else {
             $textNode->setNodeType($nodeTypes['text']);
         }
         $pageNode->setProperty('title', htmlspecialchars_decode($data->title));
         $this->outputLine('Setting page title of page "%s" to "%s"', array($relativeNodePath, $data->title));
         $bodyText = $this->prepareBodyText($data->body, $relativeNodePath);
         $textNode->setProperty('title', '');
         $textNode->setProperty('text', $bodyText);
     }
     $importRootNodePath = $importRootNode->getPath();
     $currentParentNodePath = '';
     /** @var NodeInterface $previousNode */
     $previousNode = NULL;
     foreach ($orderedNodePaths as $nodePath) {
         $node = $importRootNode->getNode($importRootNodePath . $nodePath);
         if ($node !== NULL) {
             if ($node->getParent()->getPath() !== $currentParentNodePath) {
                 $currentParentNodePath = $node->getParent()->getPath();
                 $previousNode = NULL;
             }
             if ($previousNode !== NULL) {
                 $this->outputLine('Moved node %s', array($node->getPath()));
                 $this->outputLine('after node %s', array($previousNode->getPath()));
                 $node->moveAfter($previousNode);
             } else {
                 // FIXME: Node->isFirst() or Node->moveFirst() would be needed here
             }
             $previousNode = $node;
         } else {
             $this->outputLine('Node %s does not exist.', array($importRootNodePath . $nodePath));
         }
     }
     $this->siteRepository->update($this->currentSite);
 }
开发者ID:neos,项目名称:doctools,代码行数:101,代码来源:DocumentationCommandController.php


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