MetaDataRepository

readonly class \TYPO3\CMS\Core\Resource\Index\MetaDataRepository

Repository Class as an abstraction layer to sys_file_metadata

Every access to table sys_file_metadata which is not handled by DataHandler has to use this Repository class. It resolves the workspace and the language version of a metadata record for the current context.

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Methods

__construct()  : mixed
createMetaDataRecord()  : array
Create empty
findByFile()  : array
Returns array of meta-data properties
findByFileUid()  : array<string, string>
Retrieves metadata for file
findDefaultLanguageRecordByFileUid()  : array<string, string>
Retrieves the stored metadata record of a file in the default language, without resolving its workspace or language version. This is the record that is written to, which still exists if findByFileUid() returns nothing because the record is deleted in the current workspace.
removeByFileUid()  : void
Remove all metadata records for a certain file from the database
update()  : array
Updates the metadata record in the database
getTableFields()  : array<string, ColumnInfo>
Gets the fields that are available in the table

Methods

createMetaDataRecord()

Create empty

public createMetaDataRecord(int $fileUid[, array $additionalFields = [] ]) : array

Parameters

$fileUid : int
$additionalFields : array = []

Return values

array

findByFile()

Returns array of meta-data properties

public findByFile(File $file) : array

Parameters

$file : File

Return values

array

findDefaultLanguageRecordByFileUid()

Retrieves the stored metadata record of a file in the default language, without resolving its workspace or language version. This is the record that is written to, which still exists if findByFileUid() returns nothing because the record is deleted in the current workspace.

public findDefaultLanguageRecordByFileUid(int $uid) : array<string, string>

Parameters

$uid : int

Tags

throws
InvalidUidException

Return values

array<string, string>

removeByFileUid()

Remove all metadata records for a certain file from the database

public removeByFileUid(int $fileUid) : void

Parameters

$fileUid : int

update()

Updates the metadata record in the database

public update(int $fileUid, array $updateData[, array|null $metaDataFromDatabase = null ]) : array

Parameters

$fileUid : int

the file uid to update

$updateData : array

Data to update

$metaDataFromDatabase : array|null = null

Current meta data from database

Return values

array —

The updated database record - or just $metaDataFromDatabase if no update was done

getTableFields()

Gets the fields that are available in the table

protected getTableFields() : array<string, ColumnInfo>

Return values

array<string, ColumnInfo>
On this page