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


PHP ResourceManager::getCollections方法代码示例

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


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

示例1: publishCommand

 /**
  * Publish resources
  *
  * This command publishes the resources of the given or - if none was specified, all - resource collections
  * to their respective configured publishing targets.
  *
  * @param string $collection If specified, only resources of this collection are published. Example: 'persistent'
  * @return void
  */
 public function publishCommand($collection = NULL)
 {
     try {
         if ($collection === NULL) {
             $collections = $this->resourceManager->getCollections();
         } else {
             $collections = array();
             $collections[$collection] = $this->resourceManager->getCollection($collection);
             if ($collections[$collection] === NULL) {
                 $this->outputLine('Collection "%s" does not exist.', array($collection));
                 $this->quit(1);
             }
         }
         foreach ($collections as $collection) {
             /** @var CollectionInterface $collection */
             $this->outputLine('Publishing resources of collection "%s"', array($collection->getName()));
             $collection->publish();
         }
     } catch (Exception $exception) {
         $this->outputLine();
         $this->outputLine('An error occurred while publishing resources (see full description below). You can check and probably fix the integrity of the resource registry by using the resource:clean command.');
         $this->outputLine('%s (Exception code: %s)', array(get_class($exception), $exception->getCode()));
         $this->outputLine($exception->getMessage());
         $this->quit(1);
     }
 }
开发者ID:sakona999,项目名称:flow-login,代码行数:35,代码来源:ResourceCommandController.php

示例2: publishCommand

 /**
  * Publish resources
  *
  * This command publishes the resources of the given or - if none was specified, all - resource collections
  * to their respective configured publishing targets.
  *
  * @param string $collection If specified, only resources of this collection are published. Example: 'persistent'
  * @return void
  */
 public function publishCommand($collection = null)
 {
     try {
         if ($collection === null) {
             $collections = $this->resourceManager->getCollections();
         } else {
             $collections = [];
             $collections[$collection] = $this->resourceManager->getCollection($collection);
             if ($collections[$collection] === null) {
                 $this->outputLine('Collection "%s" does not exist.', [$collection]);
                 $this->quit(1);
             }
         }
         foreach ($collections as $collection) {
             /** @var CollectionInterface $collection */
             $this->outputLine('Publishing resources of collection "%s"', [$collection->getName()]);
             $target = $collection->getTarget();
             $target->publishCollection($collection, function ($iteration) {
                 $this->clearState($iteration);
             });
         }
         if ($this->messageCollector->hasMessages()) {
             $this->outputLine();
             $this->outputLine('The resources were published, but a few inconsistencies were detected. You can check and probably fix the integrity of the resource registry by using the resource:clean command.');
             $this->messageCollector->flush(function (Message $notification) {
                 $this->outputLine($notification->getSeverity() . ': ' . $notification->getMessage());
             });
         }
     } catch (Exception $exception) {
         $this->outputLine();
         $this->outputLine('An error occurred while publishing resources (see full description below). You can check and probably fix the integrity of the resource registry by using the resource:clean command.');
         $this->outputLine('%s (Exception code: %s)', [get_class($exception), $exception->getCode()]);
         $this->outputLine($exception->getMessage());
         $this->quit(1);
     }
 }
开发者ID:mkeitsch,项目名称:flow-development-collection,代码行数:45,代码来源:ResourceCommandController.php


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