function updateJobDemo in TMGMT Translator Smartling 8.3
Same name and namespace in other branches
- 8.4 vendor/smartling/api-sdk-php/examples/jobs-example.php \updateJobDemo()
Parameters
\Smartling\AuthApi\AuthApiInterface $authProvider:
string $projectId:
string $jobId:
Return value
string
1 call to updateJobDemo()
- jobs-example.php in vendor/
smartling/ api-sdk-php/ examples/ jobs-example.php
File
- vendor/
smartling/ api-sdk-php/ examples/ jobs-example.php, line 126
Code
function updateJobDemo($authProvider, $projectId, $jobId) {
echo "--- Update job ---\n";
$result = FALSE;
$jobs = \Smartling\Jobs\JobsApi::create($authProvider, $projectId);
$params = new \Smartling\Jobs\Params\UpdateJobParameters();
$params
->setName("Test Job Name Updated " . time());
$params
->setDescription("Test Job Description Updated " . time());
$params
->setDueDate(DateTime::createFromFormat('Y-m-d H:i:s', '2030-01-01 19:19:17', new DateTimeZone('UTC')));
$st = microtime(true);
try {
$response = $jobs
->updateJob($jobId, $params);
} catch (\Smartling\Exceptions\SmartlingApiException $e) {
var_dump($e
->getErrors());
}
$et = microtime(true);
$time = $et - $st;
echo vsprintf('Request took %s seconds.%s', [
round($time, 3),
"\n\r",
]);
if (!empty($response)) {
$result = $response['translationJobUid'];
var_dump($response);
}
return $result;
}