コード例 #1
1
 /**
  * @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);
 }
コード例 #2
0
 public function whenNotAllowed(MethodNotAllowedHttpException $e)
 {
     $response = $this->createApiProblemResponse($e->getMessage(), Response::HTTP_METHOD_NOT_ALLOWED);
     $response->headers->add($e->getHeaders());
     return $response;
 }