本文整理匯總了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;
}