You are here

public function PushCallbackController::callback in TMGMT Translator Smartling 8.2

Same name and namespace in other branches
  1. 8.4 src/Controller/PushCallbackController.php \Drupal\tmgmt_smartling\Controller\PushCallbackController::callback()
  2. 8 src/Controller/PushCallbackController.php \Drupal\tmgmt_smartling\Controller\PushCallbackController::callback()
  3. 8.3 src/Controller/PushCallbackController.php \Drupal\tmgmt_smartling\Controller\PushCallbackController::callback()
1 string reference to 'PushCallbackController::callback'
tmgmt_smartling.routing.yml in ./tmgmt_smartling.routing.yml
tmgmt_smartling.routing.yml

File

src/Controller/PushCallbackController.php, line 13

Class

PushCallbackController

Namespace

Drupal\tmgmt_smartling\Controller

Code

public function callback(Request $request) {

  // Check if we have a job.
  if (!$request
    ->get('job')) {
    throw new NotFoundHttpException();
  }

  // Check if we have a job.
  if (!$request
    ->get('fileUri') || !$request
    ->get('locale')) {
    throw new NotFoundHttpException();
  }
  $job = Job::load($request
    ->get('job'));
  if (!$job) {
    throw new NotFoundHttpException();
  }
  tmgmt_smartling_download_file($job);
  return new Response('OK');
}