socialIssueRepository ->find($id); if (null === $socialIssue) { throw $this->createNotFoundException('socialIssue not found'); } $socialActions = SocialAction::filterRemoveDeactivatedActions( $socialIssue->getRecursiveSocialActions()->toArray(), \DateTime::createFromImmutable($this->clock->now()) ); usort($socialActions, static fn (SocialAction $sa, SocialAction $sb) => $sa->getOrdering() <=> $sb->getOrdering()); $pagination = $this->paginator->create(count($socialActions)); // max one page $pagination->setItemsPerPage(count($socialActions)); $collection = new Collection($socialActions, $pagination); return $this->json($collection, JsonResponse::HTTP_OK, [], ['groups' => ['read']]); } }