You are here

public static function LingotekSync::getEntityIdsByStatuses in Lingotek Translation 7.7

1 call to LingotekSync::getEntityIdsByStatuses()
lingotek_grid_update in ./lingotek.bulk_grid.inc

File

lib/Drupal/lingotek/LingotekSync.php, line 928
LingotekSync

Class

LingotekSync
A utility class for Lingotek Syncing.

Code

public static function getEntityIdsByStatuses($entity_type, $statuses = array(), $locales = NULL) {
  if ($locales === NULL) {
    $verb = 'LIKE';
    $target_locales = 'target_sync_status_%';
  }
  else {
    $verb = 'IN';
    $target_locales = array();
    foreach ($locales as $l) {
      $target_locales[] = 'target_sync_status_' . $l;
    }
  }
  $or = db_or();
  foreach ($statuses as $status) {
    $or
      ->condition('value', $status);
  }
  $query = db_select('lingotek_entity_metadata', 'l')
    ->distinct()
    ->condition('entity_type', $entity_type)
    ->condition('entity_key', $target_locales, $verb)
    ->condition($or)
    ->condition('value', LingotekSync::PROFILE_DISABLED, '<>');
  $query
    ->addField('l', 'entity_id', 'nid');
  $result = $query
    ->execute()
    ->fetchCol();
  return $result;
}