public function execute(HTTPRequestCustom $request) { $id = $request->get_int('id', null); $code = -1; if ($id !== null) { $extended_field = new ExtendedField(); $extended_field->set_id($id); $exist_field = ExtendedFieldsDatabaseService::check_field_exist_by_id($extended_field); if ($exist_field) { ExtendedFieldsService::delete_by_id($id); $code = $id; } } return new JSONResponse(array('code' => $code)); }