Nextcloud PHP API (master)

IMetadataQuery

Model that help building queries with metadata and metadata indexes

Tags
since
28.0.0

Table of Contents

Constants

EXTRA  = 'metadata'

Methods

extractMetadata()  : IFilesMetadata
extract metadata from a result row
getMetadataKeyField()  : string
returns the name of the field for metadata key to be used in query expressions
getMetadataValueField()  : string
returns the name of the field for metadata string value to be used in query expressions
joinIndex()  : string
join the metadata_index table, based on a metadataKey.
retrieveMetadata()  : void
Add metadata linked to file id to the query

Constants

Methods

extractMetadata()

extract metadata from a result row

public extractMetadata(array<string|int, mixed> $row) : IFilesMetadata
Parameters
$row : array<string|int, mixed>

result row

Tags
see
self::retrieveMetadata()
since
28.0.0
Return values
IFilesMetadata

metadata

getMetadataKeyField()

returns the name of the field for metadata key to be used in query expressions

public getMetadataKeyField(string $metadataKey) : string
Parameters
$metadataKey : string

metadata key

Tags
since
28.0.0
Return values
string

table field

getMetadataValueField()

returns the name of the field for metadata string value to be used in query expressions

public getMetadataValueField(string $metadataKey) : string

Note: this method loads lazy appconfig values.

Parameters
$metadataKey : string

metadata key

Tags
since
28.0.0
Return values
string

table field

joinIndex()

join the metadata_index table, based on a metadataKey.

public joinIndex(string $metadataKey[, bool $enforce = false ]) : string

This will prep the query for condition based on this specific metadataKey. If a link to the metadataKey already exists, returns known alias.

TODO: investigate how to support a search done on multiple values for same key (AND).

Parameters
$metadataKey : string

metadata key

$enforce : bool = false

limit the request only to existing metadata

Tags
since
28.0.0
Return values
string

generated table alias

retrieveMetadata()

Add metadata linked to file id to the query

public retrieveMetadata() : void
Tags
see
self::extractMetadata()
since
28.0.0

        
On this page

Search results