goalRepository->countBySocialActionWithDescendants($action, true); $paginator = $this->paginator->create($totalItems); $entities = $this->goalRepository->findBySocialActionWithDescendants( $action, ['id' => 'ASC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber(), onlyActive: true ); $model = new Collection($entities, $paginator); return $this->json($model, Response::HTTP_OK, [], ['groups' => ['read']]); } }