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


PHP ResourceManager::deleteResource方法代码示例

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


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

示例1: convertFrom

 /**
  * Convert an object from $source to an \TYPO3\Media\Domain\Model\AssetInterface implementation
  *
  * @param mixed $source
  * @param string $targetType must implement 'TYPO3\Media\Domain\Model\AssetInterface'
  * @param array $convertedChildProperties
  * @param PropertyMappingConfigurationInterface $configuration
  * @return \TYPO3\Flow\Validation\Error|\TYPO3\Media\Domain\Model\Image The converted Image, a Validation Error or NULL
  * @throws \TYPO3\Flow\Property\Exception\InvalidTargetException
  */
 public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = NULL)
 {
     $object = NULL;
     if (is_string($source) && $source !== '') {
         $source = array('__identity' => $source);
     }
     if (isset($convertedChildProperties['resource']) && $convertedChildProperties['resource'] instanceof Resource) {
         $resource = $convertedChildProperties['resource'];
         if (isset($this->resourcesAlreadyConvertedToAssets[$resource->getSha1()])) {
             $object = $this->resourcesAlreadyConvertedToAssets[$resource->getSha1()];
         }
         // This is pretty late to override the targetType, but usually you want to determine the model type from the resource when a new resource was uploaded...
         $targetType = $this->applyModelMappingStrategy($targetType, $resource, $source);
     }
     if ($object === NULL) {
         // TODO: This is a fix for 2.0 that you can have binary identical assets with different name. Should be fixed in 2.0, the following is the original line: if ($configuration !== NULL && $configuration->getConfigurationValue(self::class, self::CONFIGURATION_ONE_PER_RESOURCE) === TRUE && isset($convertedChildProperties['resource'])) {
         if ($configuration !== NULL && FALSE && isset($convertedChildProperties['resource'])) {
             $resource = $convertedChildProperties['resource'];
             $possibleAsset = $this->assetRepository->findOneByResourceSha1($resource->getSha1());
             if ($possibleAsset !== NULL) {
                 $this->resourceManager->deleteResource($resource);
                 return $possibleAsset;
             }
         }
         $object = parent::convertFrom($source, $targetType, $convertedChildProperties, $configuration);
     }
     if ($object instanceof AssetInterface) {
         $object = $this->applyTypeSpecificHandling($object, $source, $convertedChildProperties, $configuration);
         if ($object !== NULL) {
             $this->resourcesAlreadyConvertedToAssets[$object->getResource()->getSha1()] = $object;
             if (isset($resource) && $resource !== $object->getResource()) {
                 $this->resourceManager->deleteResource($resource);
             }
         }
     }
     return $object;
 }
开发者ID:belliconag,项目名称:media,代码行数:47,代码来源:AssetInterfaceConverter.php

示例2: convertFrom

 /**
  * Convert an object from $source to an \TYPO3\Media\Domain\Model\AssetInterface implementation
  *
  * @param mixed $source
  * @param string $targetType must implement 'TYPO3\Media\Domain\Model\AssetInterface'
  * @param array $convertedChildProperties
  * @param PropertyMappingConfigurationInterface $configuration
  * @return \TYPO3\Flow\Validation\Error|\TYPO3\Media\Domain\Model\AssetInterface The converted asset, a Validation Error or NULL
  * @throws \TYPO3\Flow\Property\Exception\InvalidTargetException
  */
 public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = null)
 {
     $object = null;
     if (is_string($source) && $source !== '') {
         $source = array('__identity' => $source);
     }
     if (isset($convertedChildProperties['resource']) && $convertedChildProperties['resource'] instanceof Resource) {
         $resource = $convertedChildProperties['resource'];
         if (isset($this->resourcesAlreadyConvertedToAssets[$resource->getSha1()])) {
             $object = $this->resourcesAlreadyConvertedToAssets[$resource->getSha1()];
         }
         // This is pretty late to override the targetType, but usually you want to determine the model type from the resource when a new resource was uploaded...
         $targetType = $this->applyModelMappingStrategy($targetType, $resource, $source);
     }
     if ($object === null) {
         if ($configuration !== null && $configuration->getConfigurationValue(self::class, self::CONFIGURATION_ONE_PER_RESOURCE) === true && isset($convertedChildProperties['resource'])) {
             $resource = $convertedChildProperties['resource'];
             $possibleAsset = $this->assetRepository->findOneByResourceSha1($resource->getSha1());
             if ($possibleAsset !== null) {
                 $this->resourceManager->deleteResource($resource);
                 return $possibleAsset;
             }
         }
         $object = parent::convertFrom($source, $targetType, $convertedChildProperties, $configuration);
     }
     if ($object instanceof AssetInterface) {
         $object = $this->applyTypeSpecificHandling($object, $source, $convertedChildProperties, $configuration);
         if ($object !== null) {
             $this->resourcesAlreadyConvertedToAssets[$object->getResource()->getSha1()] = $object;
             if (isset($resource) && $resource !== $object->getResource()) {
                 $this->resourceManager->deleteResource($resource);
             }
         }
     }
     return $object;
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:46,代码来源:AssetInterfaceConverter.php

示例3: preRemove

 /**
  * Doctrine lifecycle event callback which is triggered on "preRemove" events.
  * This method triggers the deletion of data related to this resource.
  *
  * @return void
  * @ORM\PreRemove
  */
 public function preRemove()
 {
     if ($this->lifecycleEventsActive && $this->deleted === false) {
         $this->resourceManager->deleteResource($this);
     }
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:13,代码来源:Resource.php


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