viewHandler = $viewHandler; $this->repository = $repository; } /** * @SWG\Response( * response=200, * description="Returns the collection of all existing customer", * @SWG\Schema(ref=@Model(type=Customer::class)), * ) * * @return Response */ public function cgetAction() { $data = $this->repository->findAll(); $view = new View($data, 200); return $this->viewHandler->handle($view); } /** * @SWG\Response( * response=200, * description="Returns one customer entity", * @SWG\Schema(ref=@Model(type=Customer::class)), * ) * * @param int $id * @return Response */ public function getAction($id) { $data = $this->repository->find($id); if (null === $data) { throw new NotFoundException(); } $view = new View($data, 200); return $this->viewHandler->handle($view); } }