本文整理汇总了PHP中TYPO3\CMS\Core\Resource\ResourceFactory::getDefaultStorage方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceFactory::getDefaultStorage方法的具体用法?PHP ResourceFactory::getDefaultStorage怎么用?PHP ResourceFactory::getDefaultStorage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Resource\ResourceFactory
的用法示例。
在下文中一共展示了ResourceFactory::getDefaultStorage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: downloadRegistrationsCsv
/**
* Initiates the CSV downloads for registrations of the given event uid
*
* @param int $eventUid EventUid
* @param array $settings Settings
*
* @throws \RuntimeException RuntimeException
* @return void
*/
public function downloadRegistrationsCsv($eventUid, $settings = array())
{
$storage = $this->resourceFactory->getDefaultStorage();
if ($storage === NULL) {
throw new RuntimeException('Could not get the default storage', 1475590001);
}
$registrations = $this->exportRegistrationsCsv($eventUid, $settings);
$tempFolder = $storage->getFolder('_temp_');
$tempFile = $storage->createFile('sf_events_export.csv', $tempFolder);
$tempFile->setContents($registrations);
$storage->dumpFileContents($tempFile, TRUE, 'registrations_' . date('dmY_His') . '.csv');
}
示例2: downloadiCalendarFile
/**
* Initiates the ICS download for the given event
*
* @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event The event
*
* @throws \RuntimeException Exception
*
* @return void
*/
public function downloadiCalendarFile(\DERHANSEN\SfEventMgt\Domain\Model\Event $event)
{
$storage = $this->resourceFactory->getDefaultStorage();
if ($storage === NULL) {
throw new \RuntimeException('Could not get the default storage', 1475590001);
}
$icalContent = $this->getICalendarContent($event);
$tempFolder = $storage->getFolder('_temp_');
$tempFile = $storage->createFile('event.ics', $tempFolder);
$tempFile->setContents($icalContent);
$storage->dumpFileContents($tempFile, TRUE, 'event_' . $event->getUid() . '.ics');
}
示例3: getCategoryImageFolder
/**
* Get Category Image folder
*
* @return \TYPO3\CMS\Core\Resource\Folder|void
* @throws \Exception
*/
protected function getCategoryImageFolder()
{
if ($this->categoryImageFolder === null) {
$storage = $this->resourceFactory->getDefaultStorage();
if (!$storage) {
throw new \Exception('No default storage set!');
}
try {
$this->categoryImageFolder = $storage->getFolder(self::FOLDER_CATEGORY_IMAGES);
} catch (\TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException $exception) {
$this->categoryImageFolder = $storage->createFolder(self::FOLDER_CATEGORY_IMAGES);
}
}
return $this->categoryImageFolder;
}