public static function LingotekSync::getEntityIdsToUpload in Lingotek Translation 7.5
Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getEntityIdsToUpload()
- 7.6 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getEntityIdsToUpload()
1 call to LingotekSync::getEntityIdsToUpload()
File
- lib/
Drupal/ lingotek/ LingotekSync.php, line 668 - LingotekSync
Class
- LingotekSync
- A utility class for Lingotek Syncing.
Code
public static function getEntityIdsToUpload($entity_type) {
// $query = db_select('{lingotek_entity_metadata}', 'l')
// ->distinct()
// ->condition('entity_type', $entity_type)
// ->condition('entity_key', 'node_sync_status')
// ->condition('value', LingotekSync::STATUS_EDITED);
// $query->addField('l', 'entity_id');
$info = entity_get_info($entity_type);
$id_key = $info['entity keys']['id'];
$query = db_select('{' . $info['base table'] . '}', 'base');
$query
->addField('base', $id_key);
$query
->leftJoin('{lingotek_entity_metadata}', 'upload', 'upload.entity_id = base.' . $id_key . ' and upload.entity_type =\'' . $entity_type . '\' and upload.entity_key = \'node_sync_status\'');
if ($entity_type == 'node') {
// Exclude any target nodes created using node-based translation.
$tnid_query = db_or();
$tnid_query
->condition('base.tnid', 0);
$tnid_query
->where('base.tnid = base.nid');
$query
->condition($tnid_query);
}
$or = db_or();
$or
->condition('upload.value', LingotekSync::STATUS_EDITED);
$or
->isNull('upload.value');
$query
->condition($or);
$result = $query
->execute()
->fetchCol();
return $result;
}