security->isGranted('ROLE_USER')) { throw new AccessDeniedException('Access denied: ROLE_USER required.'); } $prospect = $this->prospectRepository->findById($id); if (null === $prospect) { throw new InvalidArgumentException(sprintf('Prospect with ID %d not found.', $id)); } return json_encode(Serializer::prospect($prospect)); } }