security->isGranted('ROLE_ADMIN')) { throw new AccessDeniedException('Access denied: ROLE_ADMIN required.'); } $prospect = $this->prospectRepository->findById($id); if (null === $prospect) { throw new InvalidArgumentException(sprintf('Prospect with ID %d not found.', $id)); } $company = $prospect->getCompany(); $this->entityManager->remove($prospect); $this->entityManager->flush(); return json_encode(['success' => true, 'message' => sprintf('Prospect "%s" deleted.', $company)]); } }