/** * @param MethodNotAllowedHttpException $exception * * @return Response */ public function createMethodNotAllowedResponse(MethodNotAllowedHttpException $exception) { $body = array('success' => false, 'error' => array('global' => $this->environmentDetectionService->isEnvironment(Environment::LOCAL) === true ? $exception->getMessage() : null)); return new JsonResponse($body, Response::HTTP_METHOD_NOT_ALLOWED); }
public function whenNotAllowed(MethodNotAllowedHttpException $e) { $response = $this->createApiProblemResponse($e->getMessage(), Response::HTTP_METHOD_NOT_ALLOWED); $response->headers->add($e->getHeaders()); return $response; }