trait MetadataHolderTrait (View source)

A structured data object may contains some elements that are actually metadata. Metadata is not included in the output of tabular data formatters (e.g. table, csv), although some of these (e.g. table) may render the metadata alongside the data. Raw data formatters (e.g. yaml, json) will render both the data and the metadata.

There are two possible options for the data format; either the data is nested inside some element, and ever other item is metadata, or the metadata may be nested inside some element, and every other item is the data rows.

Example 1: nested data

[ 'data' => [ ... rows of field data ... ], 'metadata1' => '...', 'metadata2' => '...', ]

Example 2: nested metadata

[ 'metadata' => [ ... metadata items ... ], 'rowid1' => [ ... ], 'rowid2' => [ ... ], ]

It is, of course, also possible that both the data and the metadata may be nested inside subelements.

Properties

protected $dataKey
protected $metadataKey

Methods

getDataKey()

No description

setDataKey($key)

No description

getMetadataKey()

No description

setMetadataKey($key)

No description

extractData($data)

No description

extractMetadata($data)

No description

reconstruct($data, $metadata)

No description

Details

getDataKey()

No description

setDataKey($key)

No description

Parameters

$key

getMetadataKey()

No description

setMetadataKey($key)

No description

Parameters

$key

extractData($data)

No description

Parameters

$data

extractMetadata($data)

No description

Parameters

$data

reconstruct($data, $metadata)

No description

Parameters

$data
$metadata