MetaDataRepository implements SingletonInterface
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
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $eventDispatcher : EventDispatcherInterface
- $tableFields : array<string|int, mixed>
- Internal storage for database table fields
- $tableName : string
Methods
- __construct() : mixed
- createMetaDataRecord() : array<string|int, mixed>
- Create empty
- findByFile() : array<string|int, mixed>
- Returns array of meta-data properties
- findByFileUid() : array<string|int, mixed>
- Retrieves metadata for file
- removeByFileUid() : mixed
- 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|int, mixed>
- Gets the fields that are available in the table
Properties
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$tableFields
Internal storage for database table fields
protected
array<string|int, mixed>
$tableFields
= []
$tableName
protected
string
$tableName
= 'sys_file_metadata'
Methods
__construct()
public
__construct(EventDispatcherInterface $eventDispatcher) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
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|int, mixed>
Parameters
- $uid : int
Tags
Return values
array<string|int, mixed>removeByFileUid()
Remove all metadata records for a certain file from the database
public
removeByFileUid(int $fileUid) : mixed
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
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|int, mixed>