/**
  * @param ServiceLocatorInterface $serviceLocator
  *
  * @return ApiJobDehydrator
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $viewManager = $serviceLocator->get('ViewHelperManager');
     $urlHelper = $viewManager->get('url');
     $apiJobDehydrator = new ApiJobDehydrator();
     $apiJobDehydrator->setUrl($urlHelper);
     return $apiJobDehydrator;
 }
 public function indexAction()
 {
     $organizationId = $this->params()->fromRoute('organizationId', 0);
     try {
         $jobs = $this->jobRepository->findByOrganization($organizationId);
     } catch (\Exception $e) {
         /** @var Response $response */
         $response = $this->getResponse();
         $response->setStatusCode(Response::STATUS_CODE_404);
         return $response;
     }
     $jsonModel = new JsonModel();
     $jsonModel->setVariables($this->apiJobDehydrator->dehydrateList($jobs));
     $jsonModel->setJsonpCallback('yawikParseJobs');
     return $jsonModel;
 }