You are here

public function AssetData::delete in Media: Acquia DAM 8

Deletes data stored for an asset.

Parameters

int|array $assetID: (optional) The ID of the asset the data is associated with. Can also be an array to delete the data of multiple assets.

string $name: (optional) The name of the data key. If omitted, all data associated with $assetID.

Overrides AssetDataInterface::delete

File

src/AssetData.php, line 42

Class

AssetData
Acquia DAM Asset Data service implementation.

Namespace

Drupal\media_acquiadam

Code

public function delete($assetID = NULL, $name = NULL) {
  $query = $this->connection
    ->delete('acquiadam_assets_data');

  // Cast scalars to array so we can consistently use an IN condition.
  if (isset($assetID)) {
    $query
      ->condition('asset_id', (array) $assetID, 'IN');
  }
  if (isset($name)) {
    $query
      ->condition('name', (array) $name, 'IN');
  }
  $query
    ->execute();
}