public static function LingotekSync::getTargetCountByDocumentIds in Lingotek Translation 7.6        
                          
                  
                        Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetCountByDocumentIds()
- 7.4 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetCountByDocumentIds()
- 7.5 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetCountByDocumentIds()
1 call to LingotekSync::getTargetCountByDocumentIds()
  - lingotek_get_and_update_target_progress in ./lingotek.sync.inc
- Updates the 'target_sync_status_[lang-code]' field for every target in the lingotek table
with the overall progress returned by TMS
File
 
   - lib/Drupal/lingotek/LingotekSync.php, line 454
- LingotekSync
Class
  
  - LingotekSync 
- A utility class for Lingotek Syncing.
Code
public static function getTargetCountByDocumentIds($document_ids) {
  if (empty($document_ids)) {
    return;
  }
  if (!is_array($document_ids)) {
    $document_ids = array(
      $document_ids,
    );
  }
  $subquery = db_select('lingotek_entity_metadata', 'l1')
    ->fields('l1', array(
    'entity_id',
  ))
    ->condition('l1.entity_type', 'node')
    ->condition('l1.entity_key', 'document_id')
    ->condition('l1.value', $document_ids, 'IN');
  $query = db_select('lingotek_entity_metadata', 'l');
  $query
    ->addField('l', 'entity_id', 'nid');
  $query
    ->condition('l.entity_type', 'node');
  $query
    ->condition('l.entity_key', 'target_sync_status_%', 'LIKE');
  $query
    ->condition('l.entity_id', $subquery, 'IN');
  $query
    ->addExpression('COUNT(l.entity_key)', 'targets');
  $query
    ->groupBy('l.entity_id');
  $result = $query
    ->execute()
    ->fetchAllAssoc('nid');
  return $result;
}