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