PHP 클래스 Neos\Flow\ResourceManagement\ResourceTypeConverter
Has two major working modes:
1. File Uploads by PHP
In this case, the input array is expected to be a fresh file upload following the native PHP handling. The
temporary upload file is then imported through the resource manager.
To enable the handling of files that have already been uploaded earlier, the special field ['originallySubmittedResource']
is checked. If set, it is used to fetch a file that has already been uploaded even if no file has been actually uploaded in the current request.
2. Strings / arbitrary Arrays
If the source
- is an array and contains the key '__identity'
the converter will find an existing resource with the given identity or continue and assign the given identity if
CONFIGURATION_IDENTITY_CREATION_ALLOWED is set.
- is a string looking like a SHA1 (40 characters [0-9a-f]) or
- is an array and contains the key 'hash' with a value looking like a SHA1 (40 characters [0-9a-f])
the converter will look up an existing PersistentResource with that hash and return it if found. If that fails,
the converter will try to import a file named like that hash from the configured CONFIGURATION_RESOURCE_LOAD_PATH.
If no hash is given in an array source but the key 'data' is set, the content of that key is assumed a binary string
and a PersistentResource representing this content is created and returned.
The imported PersistentResource will be given a 'filename' if set in the source array in both cases (import from file or data).
파일 보기
프로젝트 열기: neos/flow-development-collection
1 사용 예제들
보호된 프로퍼티들
공개 메소드들
메소드 |
설명 |
|
convertFrom ( array $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : PersistentResource | Neos\Error\Messages\Error |
Converts the given string or array to a PersistentResource object. |
|
보호된 메소드들
메소드 |
설명 |
|
getCollectionName ( array $source, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : string |
Get the collection name this resource will be stored in. Default will be ResourceManager::DEFAULT_PERSISTENT_COLLECTION_NAME
The propertyMappingConfiguration CONFIGURATION_COLLECTION_NAME will directly override the default. Then if CONFIGURATION_ALLOW_COLLECTION_OVERRIDE is TRUE
and __collectionName is in the $source this will finally be the value. |
|
handleFileUploads ( array $source, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : PersistentResource | Neos\Error\Messages\Error |
|
|
handleHashAndData ( array $source, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : PersistentResource | Neos\Error\Messages\Error |
|
|
메소드 상세
If the input format is an array, this method assumes the resource to be a
fresh file upload and imports the temporary upload file through the
ResourceManager.
Note that $source['error'] will also be present if a file was successfully
uploaded. In that case its value will be \UPLOAD_ERR_OK.
public convertFrom ( array $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : PersistentResource | Neos\Error\Messages\Error |
$source |
array |
The upload info (expected keys: error, name, tmp_name) |
$targetType |
string |
|
$convertedChildProperties |
array |
|
$configuration |
Neos\Flow\Property\PropertyMappingConfigurationInterface |
|
리턴 |
PersistentResource | Neos\Error\Messages\Error |
if the input format is not supported or could not be converted for other reasons |
getCollectionName()
보호된 메소드
Get the collection name this resource will be stored in. Default will be ResourceManager::DEFAULT_PERSISTENT_COLLECTION_NAME
The propertyMappingConfiguration CONFIGURATION_COLLECTION_NAME will directly override the default. Then if CONFIGURATION_ALLOW_COLLECTION_OVERRIDE is TRUE
and __collectionName is in the $source this will finally be the value.
protected getCollectionName ( array $source, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : string |
$source |
array |
|
$configuration |
Neos\Flow\Property\PropertyMappingConfigurationInterface |
|
리턴 |
string |
|
handleFileUploads()
보호된 메소드
protected handleFileUploads ( array $source, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : PersistentResource | Neos\Error\Messages\Error |
$source |
array |
|
$configuration |
Neos\Flow\Property\PropertyMappingConfigurationInterface |
|
리턴 |
PersistentResource | Neos\Error\Messages\Error |
|
handleHashAndData()
보호된 메소드
protected handleHashAndData ( array $source, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : PersistentResource | Neos\Error\Messages\Error |
$source |
array |
|
$configuration |
Neos\Flow\Property\PropertyMappingConfigurationInterface |
|
리턴 |
PersistentResource | Neos\Error\Messages\Error |
|
프로퍼티 상세
$convertedResources 보호되어 있는 프로퍼티
protected array $convertedResources |
리턴 |
array |
|
$persistenceManager 보호되어 있는 프로퍼티
protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager |
리턴 |
Neos\Flow\Persistence\PersistenceManagerInterface |
|
$resourceManager 보호되어 있는 프로퍼티
protected ResourceManager,Neos\Flow\ResourceManagement $resourceManager |
리턴 |
ResourceManager |
|
$resourceRepository 보호되어 있는 프로퍼티
protected ResourceRepository,Neos\Flow\ResourceManagement $resourceRepository |
리턴 |
ResourceRepository |
|
$sourceTypes 보호되어 있는 프로퍼티
protected array $sourceTypes |
리턴 |
array |
|
$systemLogger 보호되어 있는 프로퍼티
protected SystemLoggerInterface,Neos\Flow\Log $systemLogger |
리턴 |
Neos\Flow\Log\SystemLoggerInterface |
|
protected string $targetType |
리턴 |
string |
|