You are here

public static function LingotekSync::getDocIdFromEntityId in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getDocIdFromEntityId()
  2. 7.6 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getDocIdFromEntityId()

File

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

Class

LingotekSync
A utility class for Lingotek Syncing.

Code

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