You are here

function lingotek_get_document_id_tree in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.util.inc \lingotek_get_document_id_tree()
  2. 7.5 lingotek.util.inc \lingotek_get_document_id_tree()
1 call to lingotek_get_document_id_tree()
lingotek_get_entities_by_profile_and_entity_type in ./lingotek.util.inc

File

./lingotek.util.inc, line 1565
Utility functions.

Code

function lingotek_get_document_id_tree() {
  $query = db_select('lingotek_entity_metadata', 'lem')
    ->fields('lem', array(
    'entity_id',
    'entity_type',
    'value',
  ))
    ->condition('lem.entity_key', 'document_id')
    ->execute();
  $results = $query
    ->fetchAll();
  $doc_id_tree = array();
  foreach ($results as $r) {
    if (!isset($doc_id_tree[$r->entity_type])) {
      $doc_id_tree[$r->entity_type] = array();
    }
    $doc_id_tree[$r->entity_type][$r->entity_id] = $r->value;
  }
  return $doc_id_tree;
}