FileRepository

Read onlyYes

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()  : array<string|int, 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()  : array<string|int, 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 ]) : array<string|int, 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
array<string|int, 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<string|int, mixed> $databaseRow) : File
Parameters
$databaseRow : array<string|int, mixed>
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

reapplySorting()

As sorting might have changed due to workspace overlays, PHP does the sorting again.

protected reapplySorting(array<string|int, FileReference$itemList) : array<string|int, FileReference>
Parameters
$itemList : array<string|int, FileReference>
Return values
array<string|int, FileReference>

        
On this page

Search results