You are here

public static function LingotekSync::getEntityIdsByTargetStatus in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getEntityIdsByTargetStatus()
1 call to LingotekSync::getEntityIdsByTargetStatus()
lingotek_grid_update in ./lingotek.bulk_grid.inc

File

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

Class

LingotekSync
A utility class for Lingotek Syncing.

Code

public static function getEntityIdsByTargetStatus($entity_type, $status, $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;
    }
  }
  $query = db_select('lingotek_entity_metadata', 'l')
    ->distinct()
    ->condition('entity_type', $entity_type)
    ->condition('entity_key', $target_locales, $verb)
    ->condition('value', $status);
  $query
    ->addField('l', 'entity_id', 'nid');
  $result = $query
    ->execute()
    ->fetchCol();
  return $result;
}