ResourceFactory implements SingletonInterface
Factory class for FAL objects
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
Methods
- __construct() : mixed
- createCollectionObject() : CollectionInterface<string|int, File>
- Creates a collection object.
- createFileObject() : File
- Creates a file object from an array of file data. Requires a database row to be fetched.
- createFileReferenceObject() : FileReference
- Creates a file usage object from an array of fileReference data from sys_file_reference table.
- getCollectionObject() : CollectionInterface
- Creates an instance of the collection from given UID. The $recordData can be supplied to increase performance.
- getFileObject() : File
- Creates an instance of the file given UID. The $fileData can be supplied to increase performance.
- getFileObjectFromCombinedIdentifier() : File|ProcessedFile|null
- Gets a file object from an identifier [storage]:[fileId]
- getFileReferenceObject() : FileReference
- Creates an instance of a FileReference object. The $fileReferenceData can be supplied to increase performance.
- getFolderObjectFromCombinedIdentifier() : Folder
- Gets a folder object from an identifier [storage]:[fileId]
- getObjectFromCombinedIdentifier() : FileInterface|Folder
- Gets a file or folder object.
- retrieveFileOrFolderObject() : ProcessedFile|File|Folder|null
- Bulk function, can be used for anything to get a file or folder
- collectionCacheGet() : CollectionInterface<string|int, File>|null
- collectionCacheIdentifier() : string
- collectionCacheSet() : void
- fileCacheGet() : File|null
- fileCacheIdentifier() : string
- fileCacheSet() : void
- fileReferenceCacheGet() : FileReference|null
- fileReferenceCacheIdentifier() : string
- fileReferenceCacheSet() : void
- getFileReferenceData() : array<string|int, mixed>|false|null
- Gets data for the given uid of the file reference record.
Properties
$runtimeCache
protected
FrontendInterface
$runtimeCache
Attributes
- #[Autowire]
- $service: 'cache.runtime'
$storageRepository
protected
StorageRepository
$storageRepository
Methods
__construct()
public
__construct(StorageRepository $storageRepository, FrontendInterface $runtimeCache, FileIndexRepository $fileIndexRepository) : mixed
Parameters
- $storageRepository : StorageRepository
- $runtimeCache : FrontendInterface
- $fileIndexRepository : FileIndexRepository
createCollectionObject()
Creates a collection object.
public
createCollectionObject(array<string|int, mixed> $collectionData) : CollectionInterface<string|int, File>
Parameters
- $collectionData : array<string|int, mixed>
-
The database row of the sys_file_collection record.
Return values
CollectionInterface<string|int, File>createFileObject()
Creates a file object from an array of file data. Requires a database row to be fetched.
public
createFileObject(array<string|int, mixed> $fileData[, ResourceStorage|null $storage = null ]) : File
Parameters
- $fileData : array<string|int, mixed>
- $storage : ResourceStorage|null = null
Return values
FilecreateFileReferenceObject()
Creates a file usage object from an array of fileReference data from sys_file_reference table.
public
createFileReferenceObject(array<string|int, mixed> $fileReferenceData) : FileReference
Requires a database row to be already fetched and present.
Parameters
- $fileReferenceData : array<string|int, mixed>
Return values
FileReferencegetCollectionObject()
Creates an instance of the collection from given UID. The $recordData can be supplied to increase performance.
public
getCollectionObject(int $uid[, array<string|int, mixed> $recordData = [] ]) : CollectionInterface
Parameters
- $uid : int
-
The uid of the collection to instantiate.
- $recordData : array<string|int, mixed> = []
-
The record row from database.
Tags
Return values
CollectionInterfacegetFileObject()
Creates an instance of the file given UID. The $fileData can be supplied to increase performance.
public
getFileObject(int|string $uid[, array<string|int, mixed> $fileData = [] ]) : File
Parameters
- $uid : int|string
-
The uid of the file to instantiate. (string is used for the time being as compat-mode)
- $fileData : array<string|int, mixed> = []
-
The record row from database.
Tags
Return values
FilegetFileObjectFromCombinedIdentifier()
Gets a file object from an identifier [storage]:[fileId]
public
getFileObjectFromCombinedIdentifier(string $identifier) : File|ProcessedFile|null
Parameters
- $identifier : string
Tags
Return values
File|ProcessedFile|nullgetFileReferenceObject()
Creates an instance of a FileReference object. The $fileReferenceData can be supplied to increase performance.
public
getFileReferenceObject(int|string $uid[, array<string|int, mixed> $fileReferenceData = [] ][, bool $raw = false ]) : FileReference
Parameters
- $uid : int|string
-
The uid of the file usage (sys_file_reference) to instantiate. string is kept for backwards-compat
- $fileReferenceData : array<string|int, mixed> = []
-
The record row from database.
- $raw : bool = false
-
Whether to get raw results without performing overlays
Tags
Return values
FileReferencegetFolderObjectFromCombinedIdentifier()
Gets a folder object from an identifier [storage]:[fileId]
public
getFolderObjectFromCombinedIdentifier(string|int $identifier) : Folder
Parameters
- $identifier : string|int
Return values
FoldergetObjectFromCombinedIdentifier()
Gets a file or folder object.
public
getObjectFromCombinedIdentifier(string $identifier) : FileInterface|Folder
Parameters
- $identifier : string
Tags
Return values
FileInterface|FolderretrieveFileOrFolderObject()
Bulk function, can be used for anything to get a file or folder
public
retrieveFileOrFolderObject(string|int $input) : ProcessedFile|File|Folder|null
- It's a UID
- It's a combined identifier
- It's just a path/filename (coming from the oldstyle/backwards compatibility)
Files, previously laid on fileadmin/ or something, will be "mapped" to the storage the file is in now. Files like typo3temp/ or typo3conf/ will be moved to the first writable storage in its processing folder
$input could be
- "2:myfolder/myfile.jpg" (combined identifier)
- "23" (file UID)
- "uploads/myfile.png" (backwards-compatibility, storage "0")
- "file:23"
Parameters
- $input : string|int
Return values
ProcessedFile|File|Folder|nullcollectionCacheGet()
protected
collectionCacheGet(int $uid) : CollectionInterface<string|int, File>|null
Parameters
- $uid : int
Return values
CollectionInterface<string|int, File>|nullcollectionCacheIdentifier()
protected
collectionCacheIdentifier(int $uid) : string
Parameters
- $uid : int
Return values
stringcollectionCacheSet()
protected
collectionCacheSet(int $uid, CollectionInterface<string|int, File> $collection) : void
Parameters
- $uid : int
- $collection : CollectionInterface<string|int, File>
fileCacheGet()
protected
fileCacheGet(int $uid) : File|null
Parameters
- $uid : int
Return values
File|nullfileCacheIdentifier()
protected
fileCacheIdentifier(int $uid) : string
Parameters
- $uid : int
Return values
stringfileCacheSet()
protected
fileCacheSet(File $file) : void
Parameters
- $file : File
fileReferenceCacheGet()
protected
fileReferenceCacheGet(int $uid) : FileReference|null
Parameters
- $uid : int
Return values
FileReference|nullfileReferenceCacheIdentifier()
protected
fileReferenceCacheIdentifier(int $uid) : string
Parameters
- $uid : int
Return values
stringfileReferenceCacheSet()
protected
fileReferenceCacheSet(FileReference $fileReference) : void
Parameters
- $fileReference : FileReference
getFileReferenceData()
Gets data for the given uid of the file reference record.
protected
getFileReferenceData(int $uid[, bool $raw = false ]) : array<string|int, mixed>|false|null
Parameters
- $uid : int
-
The uid of the file usage (sys_file_reference) to be fetched
- $raw : bool = false
-
Whether to get raw results without performing overlays