You are here

function TMGMTRemoteController::loadByLocalData in Translation Management Tool 7

Loads remote mappings based on local data.

Parameters

int $tjid: Translation job id.

int $tjiid: Translation job item id.

int $data_item_key: Data item key.

Return value

array Array of TMGMTRemote entities.

File

controller/tmgmt.controller.remote.inc, line 40
Contains the remote controller class.

Class

TMGMTRemoteController
Controller class for the remote job mapping entity.

Code

function loadByLocalData($tjid = NULL, $tjiid = NULL, $data_item_key = NULL) {
  $data_item_key = tmgmt_ensure_keys_string($data_item_key);
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'tmgmt_remote');
  if (!empty($tjid)) {
    $query
      ->propertyCondition('tjid', $tjid);
  }
  if (!empty($tjiid)) {
    $query
      ->propertyCondition('tjiid', $tjiid);
  }
  if (!empty($data_item_key)) {
    $query
      ->propertyCondition('data_item_key', $data_item_key);
  }
  $result = $query
    ->execute();
  if (isset($result['tmgmt_remote'])) {
    return entity_load('tmgmt_remote', array_keys($result['tmgmt_remote']));
  }
  return array();
}