MetaDataRepository

Read onlyYes

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<string|int, mixed>
Create empty
findByFile()  : array<string|int, mixed>
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<string|int, mixed>
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<string|int, mixed> $additionalFields = [] ]) : array<string|int, mixed>
Parameters
$fileUid : int
$additionalFields : array<string|int, mixed> = []
Return values
array<string|int, mixed>

findByFile()

Returns array of meta-data properties

public findByFile(File $file) : array<string|int, mixed>
Parameters
$file : File
Return values
array<string|int, mixed>

findByFileUid()

Retrieves metadata for file

public findByFileUid(int $uid) : array<string, string>
Parameters
$uid : int
Tags
throws
InvalidUidException
Return values
array<string, string> —

$metaData

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
Internal
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<string|int, mixed> $updateData[, array<string|int, mixed>|null $metaDataFromDatabase = null ]) : array<string|int, mixed>
Parameters
$fileUid : int

the file uid to update

$updateData : array<string|int, mixed>

Data to update

$metaDataFromDatabase : array<string|int, mixed>|null = null

Current meta data from database

Internal
Return values
array<string|int, mixed> —

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

Search results