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; }
public function testFindByOrganization() { $org = $this->organization; $result = $this->repository->findByOrganization($org->getId()); $this->assertCount(6, $result); }