MetaDataAspect

class \TYPO3\CMS\Core\Resource\MetaDataAspect

Implements
ArrayAccess, Countable, Iterator

Aspect that takes care of a file's metadata

Table of Contents

Interfaces

ArrayAccess
Countable
Iterator

Methods

__construct()  : mixed
Constructor
add()  : $this
Adds already known metadata to the aspect
count()  : int
current()  : mixed
Gets the current value of iteration
get()  : array
Gets the metadata of a file. If not metadata is loaded yet, the database gets queried
getContextIdentifier()  : string
The metadata record is resolved for the language and workspace of the current context, so a loaded record must not be reused once that context changed within the same request. This is relevant whenever more than one language is rendered in a single process, for instance a command controller, a cache warmup or an Extbase query for a specific language.
key()  : string
Returns the key of the current iteration
next()  : void
Increases the index for iteration
offsetExists()  : bool
offsetGet()  : mixed
offsetSet()  : void
offsetUnset()  : void
remove()  : void
Removes a meta data record
rewind()  : void
Resets the internal iterator counter
save()  : void
Creates new or updates existing meta data
valid()  : bool
getMetaDataRepository()  : MetaDataRepository
loadFromRepository()  : array

Methods

__construct()

Constructor

public __construct(File $file) : mixed

Parameters

$file : File

add()

Adds already known metadata to the aspect

public add(array $metaData) : $this

Parameters

$metaData : array

Return values

$this

count()

public count() : int

Return values

int

current()

Gets the current value of iteration

public current() : mixed

get()

Gets the metadata of a file. If not metadata is loaded yet, the database gets queried

public get() : array

Return values

array

getContextIdentifier()

The metadata record is resolved for the language and workspace of the current context, so a loaded record must not be reused once that context changed within the same request. This is relevant whenever more than one language is rendered in a single process, for instance a command controller, a cache warmup or an Extbase query for a specific language.

public getContextIdentifier() : string

Tags

todo

The language is still not an input of the resolution: MetaDataRepository::findByFileUid() resolves for whatever the current context happens to be, so an explicitly requested language - Extbase query settings or a cloned Context as used by PageLinkBuilder, HrefLangGenerator or language menus - is ignored. It should become an explicit argument instead, and this cache should be keyed by it rather than by the current context. FileReference::getProperties() memoizes the merged metadata and uses this identifier for the very same reason, which is why it is exposed at all.

Return values

string

key()

Returns the key of the current iteration

public key() : string

Return values

string

next()

Increases the index for iteration

public next() : void

offsetExists()

public offsetExists(mixed $offset) : bool

Parameters

$offset : mixed

Return values

bool

offsetGet()

public offsetGet(mixed $offset) : mixed

Parameters

$offset : mixed

offsetSet()

public offsetSet(mixed $offset, mixed $value) : void

Parameters

$offset : mixed
$value : mixed

offsetUnset()

public offsetUnset(mixed $offset) : void

Parameters

$offset : mixed

remove()

Removes a meta data record

public remove() : void

rewind()

Resets the internal iterator counter

public rewind() : void

save()

Creates new or updates existing meta data

public save() : void

valid()

public valid() : bool

Return values

bool

loadFromRepository()

protected loadFromRepository() : array

Return values

array
On this page