You are here

public static function LingotekConfigSet::loadByLingotekDocumentId in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.6 lib/Drupal/lingotek/LingotekConfigSet.php \LingotekConfigSet::loadByLingotekDocumentId()

Loads a LingotekConfigSet by Lingotek Document ID.

Parameters

string $lingotek_document_id: The Document ID whose corresponding set should be loaded.

string $lingotek_language_code: The language code associated with the Lingotek Document ID.

int $lingotek_project_id: The Lingotek project ID associated with the Lingotek Document ID.

Return value

mixed A LingotekConfigSet object on success, FALSE on failure.

2 calls to LingotekConfigSet::loadByLingotekDocumentId()
lingotek_get_trans_obj in ./lingotek.sync.inc
lingotek_update_config_progress in ./lingotek.sync.inc
Updates the 'target_sync_status_[lang-code]' field for every target in the lingotek_config_metadata table with the overall progress returned by TMS

File

lib/Drupal/lingotek/LingotekConfigSet.php, line 590
Defines LingotekConfigSet.

Class

LingotekConfigSet
A class wrapper for Lingotek-specific behavior on ConfigSets.

Code

public static function loadByLingotekDocumentId($lingotek_document_id) {
  $set = FALSE;

  // Get the set entries in the system associated with the document ID.
  $query = db_select('lingotek_config_metadata', 'meta')
    ->fields('meta', array(
    'id',
  ))
    ->condition('config_key', 'document_id')
    ->condition('value', $lingotek_document_id)
    ->execute();
  $set_id = $query
    ->fetchField();

  // this returns a 0 for the first id then the if shows false
  if (isset($set_id)) {
    $set = self::loadById($set_id);
  }
  return $set;
}