Adds remote mapping entity to this job item.
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.
int|bool Returns either the integer or boolean.
TMGMTException Throws an exception.
Overrides JobItemInterface::addRemoteMapping
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
->getJobId(),
'tjiid' => $this
->id(),
'data_item_key' => $data_item_key,
'remote_identifier_1' => $remote_identifier_1,
);
if (!empty($mapping_data)) {
$data += $mapping_data;
}
$remote_mapping = RemoteMapping::create($data);
return $remote_mapping
->save();
}