public function TMGMTJobItem::addRemoteMapping in Translation Management Tool 7
Adds remote mapping entity to this job item.
Parameters
string $data_item_key: Job data item key.
int $remote_identifier_1: Array of remote identifiers. In case you need to save remote_identifier_2/3 set it into $mapping_data argument.
array $mapping_data: Additional data to be added.
Return value
int|bool
Throws
File
- entity/
tmgmt.entity.job_item.inc, line 866
Class
- TMGMTJobItem
- Entity class for the tmgmt_job entity.
Code
public function addRemoteMapping($data_item_key = NULL, $remote_identifier_1 = NULL, $mapping_data = array()) {
if (empty($remote_identifier_1) && !isset($mapping_data['remote_identifier_2']) && !isset($remote_mapping['remote_identifier_3'])) {
throw new TMGMTException('Cannot create remote mapping without remote identifier.');
}
$data = array(
'tjid' => $this->tjid,
'tjiid' => $this->tjiid,
'data_item_key' => $data_item_key,
'remote_identifier_1' => $remote_identifier_1,
);
if (!empty($mapping_data)) {
$data += $mapping_data;
}
$remote_mapping = entity_create('tmgmt_remote', $data);
return entity_get_controller('tmgmt_remote')
->save($remote_mapping);
}