'error', 'key' => 'export', 'method' => 'save', 'data' => '', ]; $token = $request->headers->get('x-auth-token'); $security->isGranted('MAESTRO_PROJECT_PROJECTS_UPDATE', $token); $data = json_decode($request->getContent(), true); $body['key'] = 'request'; $body['method'] = 'getContent'; $respond->statusNotFound(); if (!isset($data['title']) && empty($data['title'])) { $body['data'] = 'Missing "title" !'; } elseif (isset($data['socialNetwork']) && empty($data['socialNetwork'])) { $body['data'] = 'Missing "socialNetwork" !'; } else { $export = $exportQuery->getExport($id); if (!empty($export)) { $create = $saveQuery->save($data, $export, null); if (!$create instanceof \Exception) { $body['method'] = 'save'; $body['data'] = $create; $respond->statusNotFound(); } else { $body['type'] = 'success'; $body['data'] = $create; $respond->statusOk(); } } else { $body['method'] = 'getExport'; $body['data'] = 'Export not found'; } } return $respond->createBody($body)->respond(); } }