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