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