You are here

public static function LingotekSync::getEntityIdFromDocId in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getEntityIdFromDocId()
  2. 7.5 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getEntityIdFromDocId()
6 calls to LingotekSync::getEntityIdFromDocId()
LingotekSync::getNodeIdFromDocId in lib/Drupal/lingotek/LingotekSync.php
LingotekSync::getTargetStatus in lib/Drupal/lingotek/LingotekSync.php
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
lingotek_get_sync_download_batch_elements in ./lingotek.batch.inc
Sync - Download Batch Elements: Creates the batch elements for nodes/documents that need to be downloaded.
lingotek_get_trans_obj in ./lingotek.sync.inc

... See full list

File

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

Class

LingotekSync
A utility class for Lingotek Syncing.

Code

public static function getEntityIdFromDocId($lingotek_document_id, $entity_type = NULL) {
  $key = 'document_id';
  $query = db_select('lingotek_entity_metadata', 'l')
    ->fields('l');
  if ($entity_type) {
    $query
      ->condition('entity_type', $entity_type);
  }
  $query
    ->condition('entity_key', $key);
  $query
    ->condition('value', $lingotek_document_id);
  $result = $query
    ->execute();
  $found = FALSE;
  $type = FALSE;
  if ($record = $result
    ->fetchAssoc()) {
    $found = $record['entity_id'];
    $type = $record['entity_type'];
  }
  return array(
    $found,
    $type,
  );
}