You are here

public static function LingotekConfigChunk::getIdByDocId in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.4 lib/Drupal/lingotek/LingotekConfigChunk.php \LingotekConfigChunk::getIdByDocId()
  2. 7.5 lib/Drupal/lingotek/LingotekConfigChunk.php \LingotekConfigChunk::getIdByDocId()

Return the chunk ID for a given Lingotek document ID, if it exists

Parameters

int: the id of a lingotek document

Return value

int the ID of a chunk of configuration segments

2 calls to LingotekConfigChunk::getIdByDocId()
LingotekSync::getTargetStatus in lib/Drupal/lingotek/LingotekSync.php
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.

File

lib/Drupal/lingotek/LingotekConfigChunk.php, line 217
Defines LingotekConfigChunk.

Class

LingotekConfigChunk
A class wrapper for Lingotek-specific behavior on ConfigChunks.

Code

public static function getIdByDocId($doc_id) {
  $query = db_select('lingotek_config_metadata', 'meta');
  $query
    ->fields('meta', array(
    'id',
  ));
  $query
    ->condition('config_key', 'document_id');
  $query
    ->condition('value', $doc_id);
  $result = $query
    ->execute();
  if ($id = $result
    ->fetchField()) {
    return $id;
  }
  return FALSE;
}