Ejemplo n.º 1
0
 public function __construct(ApiProblem $apiProblem, \Exception $previous = null, array $headers = array(), $code = 0)
 {
     $this->apiProblem = $apiProblem;
     parent::__construct($apiProblem->getStatusCode(), $apiProblem->getTitle(), $previous, $headers, $code);
 }
Ejemplo n.º 2
0
 private function throwApiProblemValidationException(array $errors)
 {
     $apiProblem = new ApiProblem(400, ApiProblem::TYPE_VALIDATION_ERROR);
     $apiProblem->set('errors', $errors);
     $response = new JsonResponse($apiProblem->toArray(), $apiProblem->getStatusCode());
     $response->headers->set('Content-Type', 'application/problem+json');
     throw new ApiProblemException($apiProblem);
 }