FileRepository

readonly class \TYPO3\CMS\Core\Resource\FileRepository

Repository for accessing file objects.

It also serves as the public API for the indexing part of files in general.

It is however recommended to use the ResourceFactory instead of this class, as it is more flexible.

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Properties

$factory  : ResourceFactory
$tcaSchemaFactory  : TcaSchemaFactory

Methods

__construct()  : mixed
findByRelation()  : FileReference[]
Find FileReference objects by relation to other records
findByUid()  : File
Finds a File matching the given uid, regardless of the storage.
createDomainObject()  : File
Creates an object managed by this repository.
isFrontend()  : bool
Function to return the current application type based on $GLOBALS['TSFE'].
reapplySorting()  : FileReference[]
As sorting might have changed due to workspace overlays, PHP does the sorting again.

Properties

Methods

findByRelation()

Find FileReference objects by relation to other records

public findByRelation(string $tableName, string $fieldName, int $uid[, int|null $workspaceId = null ]) : FileReference[]

Parameters

$tableName : string

Table name of the related record

$fieldName : string

Field name of the related record

$uid : int

The UID of the related record (needs to be the localized uid, as translated IRRE elements relate to them)

$workspaceId : int|null = null

Return values

FileReference[] —

An array of file references, empty if no objects found

findByUid()

Finds a File matching the given uid, regardless of the storage.

public findByUid(int $uid) : File

Parameters

$uid : int

Return values

File

createDomainObject()

Creates an object managed by this repository.

protected createDomainObject(array $databaseRow) : File

Parameters

$databaseRow : array

Return values

File

isFrontend()

Function to return the current application type based on $GLOBALS['TSFE'].

protected isFrontend() : bool

This function can be mocked in unit tests to be able to test frontend behaviour.

Return values

bool
On this page