You are here

function _commerce_file_license_field_query in Commerce File 7

Return all license ids for specified field values

Parameters

$fids: An array of file fids

$line_item_ids: An array of line_item_ids

$account: A user object of the license owner

Return value

An array of license ids

1 call to _commerce_file_license_field_query()
commerce_file_license_load_by_property in includes/commerce_file.entities.inc
Return all licenses for specified files

File

includes/commerce_file.entities.inc, line 259
Handles file licenses and file license logs

Code

function _commerce_file_license_field_query($fids = array(), $line_item_ids = array(), $account = NULL) {
  $entity_ids = array();
  $entity_type = COMMERCE_FILE_LICENSE_ENTITY_NAME;

  // build query
  $query = _commerce_file_license_build_field_query($fids, $line_item_ids, $account);

  // perform query if it exists and has been filtered
  if (!empty($query) && $query->_commerce_file_is_filtered) {
    $result = $query
      ->execute();
    if (!empty($result)) {
      $entity_ids = array_keys($result[$entity_type]);
    }
  }
  return $entity_ids;
}