resultRepository = $resultRepository; } public function listBySocialAction(Request $request, SocialAction $action): Response { $totalItems = $this->resultRepository->countBySocialActionWithDescendants($action); $paginator = $this->getPaginatorFactory()->create($totalItems); $entities = $this->resultRepository->findBySocialActionWithDescendants($action, ["id" => "ASC"], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber()); $model = new Collection($entities, $paginator); return $this->json($model, Response::HTTP_OK, [], [ "groups" => [ "read" ]]); } public function listByGoal(Request $request, Goal $goal): Response { $totalItems = $this->resultRepository->countByGoal($goal); $paginator = $this->getPaginatorFactory()->create($totalItems); $entities = $this->resultRepository->findByGoal($goal, ["id" => "ASC"], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber()); $model = new Collection($entities, $paginator); return $this->json($model, Response::HTTP_OK, [], [ "groups" => [ "read" ]]); } }