You are here

public static function RemoteMapping::loadByLocalData in Translation Management Tool 8

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

static[] Array of TMGMTRemote entities.

Overrides RemoteMappingInterface::loadByLocalData

1 call to RemoteMapping::loadByLocalData()
CrudTest::testRemoteMappings in tests/src/Kernel/CrudTest.php

File

src/Entity/RemoteMapping.php, line 158

Class

RemoteMapping
Entity class for the tmgmt_remote entity.

Namespace

Drupal\tmgmt\Entity

Code

public static function loadByLocalData($tjid = NULL, $tjiid = NULL, $data_item_key = NULL) {
  $data_item_key = \Drupal::service('tmgmt.data')
    ->ensureStringKey($data_item_key);
  $query = \Drupal::entityQuery('tmgmt_remote');
  if (!empty($tjid)) {
    $query
      ->condition('tjid', $tjid);
  }
  if (!empty($tjiid)) {
    $query
      ->condition('tjiid', $tjiid);
  }
  if (!empty($data_item_key)) {
    $query
      ->condition('data_item_key', $data_item_key);
  }
  $trids = $query
    ->execute();
  if (!empty($trids)) {
    return static::loadMultiple($trids);
  }
  return array();
}