public function AssetData::set in Media: Acquia DAM 8
Stores data for an asset.
Parameters
int $assetID: The ID of the asset to store data against.
string $name: The name of the data key.
mixed $value: The value to store. Non-scalar values are serialized automatically.
Overrides AssetDataInterface::set
File
- src/
AssetData.php, line 127
Class
- AssetData
- Acquia DAM Asset Data service implementation.
Namespace
Drupal\media_acquiadamCode
public function set($assetID, $name, $value) {
$serialized = (int) (!is_scalar($value));
if ($serialized) {
$value = serialize($value);
}
$this->connection
->merge('acquiadam_assets_data')
->keys([
'asset_id' => $assetID,
'name' => $name,
])
->fields([
'value' => $value,
'serialized' => $serialized,
])
->execute();
}