'error', 'key' => 'cdf', 'method' => 'createCdf', 'data' => '', ]; $token = $request->headers->get('x-auth-token'); $security->isGranted('MAESTRO_PROJECT_PROJECTS_UPDATE', $token); $data = json_decode($request->getContent(), true); $updated = $cdf->updateMaxPage($id, (int) $data['nbPages']); if (!$updated instanceof Exception) { $body['type'] = 'success'; $body['data'] = $updated; $respond->statusCreated(); } else { $body['data'] = $updated->getMessage(); $respond->statusUnprocessableEntity(); } return $respond->createBody($body)->respond(); } }