checkoutRepository->find($uriVariables['id']); if (!$checkout) { throw new HttpException(Response::HTTP_NOT_FOUND, sprintf("The checkout '%s' does not exist.", $uriVariables['id'])); } $checkout->setGatewayReference($data->gatewayReference); $this->entityManager->persist($checkout); $this->entityManager->flush(); return $checkout; } }