You are here

function media_acquiadam_assetids_to_fids in Media: Acquia DAM 7

Get managed files that have associated asset IDs.

Parameters

array $assetIds: The asset IDs to load files for.

Return value

array Any matching files from the managed files table.

File

includes/media_acquiadam.helpers.inc, line 142
Helper functions for working with Acquia DAM within Drupal.

Code

function media_acquiadam_assetids_to_fids(array $assetIds) {
  $assetIds = array_map('intval', $assetIds);
  $assetIds = array_filter($assetIds);
  $result = db_select('file_managed', 'm')
    ->addTag('acquiadam')
    ->fields('m', [
    'fid',
    'acquiadam_id',
  ])
    ->condition('m.acquiadam_id', $assetIds)
    ->execute()
    ->fetchAll();
  return $result;
}