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


PHP SiteRepository::findByNodeName方法代码示例

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


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

示例1: exportCommand

 /**
  * Export sites content
  *
  * This command exports all or one specific site with all its content into an XML format.
  *
  * If the package key option is given, the site(s) will be exported to the given package in the default
  * location Resources/Private/Content/Sites.xml.
  *
  * If the filename option is given, any resources will be exported to files in a folder named "Resources"
  * alongside the XML file.
  *
  * If neither the filename nor the package key option are given, the XML will be printed to standard output and
  * assets will be embedded into the XML in base64 encoded form.
  *
  * @param string $siteNode the node name of the site to be exported; if none given will export all sites
  * @param boolean $tidy Whether to export formatted XML
  * @param string $filename relative path and filename to the XML file to create. Any resource will be stored in a sub folder "Resources".
  * @param string $packageKey Package to store the XML file in. Any resource will be stored in a sub folder "Resources".
  * @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "TYPO3.Neos:Page", "!TYPO3.Neos:Page,TYPO3.Neos:Text")
  * @return void
  */
 public function exportCommand($siteNode = null, $tidy = false, $filename = null, $packageKey = null, $nodeTypeFilter = null)
 {
     if ($siteNode === null) {
         $sites = $this->siteRepository->findAll()->toArray();
     } else {
         $sites = $this->siteRepository->findByNodeName($siteNode)->toArray();
     }
     if (count($sites) === 0) {
         $this->outputLine('Error: No site for exporting found');
         $this->quit(1);
     }
     if ($packageKey !== null) {
         $this->siteExportService->exportToPackage($sites, $tidy, $packageKey, $nodeTypeFilter);
         if ($siteNode !== null) {
             $this->outputLine('The site "%s" has been exported to package "%s".', array($siteNode, $packageKey));
         } else {
             $this->outputLine('All sites have been exported to package "%s".', array($packageKey));
         }
     } elseif ($filename !== null) {
         $this->siteExportService->exportToFile($sites, $tidy, $filename, $nodeTypeFilter);
         if ($siteNode !== null) {
             $this->outputLine('The site "%s" has been exported to "%s".', array($siteNode, $filename));
         } else {
             $this->outputLine('All sites have been exported to "%s".', array($filename));
         }
     } else {
         $this->output($this->siteExportService->export($sites, $tidy, $nodeTypeFilter));
     }
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:50,代码来源:SiteCommandController.php


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