创建销售线索时Zoho CRM PHP SDK引发异常

时间:2018-11-23 22:59:23

标签: php sdk zoho

所以〜

我正在实现Zoho PHP SDK,以将表单连接到潜在客户CRM。但是我遇到了一个非常奇怪的错误,即我无法找到它的任何先前存在。

我正在通话:

$module = \ZCRMModule::getInstance('Leads');

$record = \ZCRMRecord::getInstance('Leads', null);
$record->setFieldValue('First_Name', $data['name']);
$record->setFieldValue('Last_Name', $data['last_name']);
$record->setFieldValue('Email', $data['email']);
$record->setFieldValue('Phone', $data['phone']);
$record->setFieldValue('Company', $data['company']);
$record->setFieldValue('Cuantos_empleados_tiene_la_empresa', $data['employees']);
$record->setFieldValue('Tienes_proyecto_por_implementar', $data['project']);

if ($data['service'] !== 'ninguno') {
    $record->setFieldValue('En_qu_servicio_est_interesado', $data['service']);
}

$response = $module->createRecords([$record]);
$entityResponses = $response->getEntityResponses();

但是,第34行的ZohoHTTPConnector.php引发异常,因为它试图对一个为null的变量进行count():

if(count(self::getRequestParamsMap())>0)

APIRequest.php上的连接器本身看起来状态良好,但是当fireRequest发生时,所有事件都消失了,因为self :: getRequestParamsMap返回null。

ZohoHTTPConnector {#209
  -url: "https://www.zohoapis.com/crm/v2/Leads"
  -requestParams: null
  -requestHeaders: array:2 [
    "Content-Type" => "application/json"
    "Authorization" => "Zoho-oauthtoken <REDACTED>"
  ]
  -requestParamCount: 0
  -requestBody: array:1 [
    "data" => array:1 [
      0 => array:8 [
        "First_Name" => "First Name"
        "Last_Name" => "Last Name"
        "Email" => "mail@mail.com"
        "Phone" => "5555555555"
        "Company" => "Test"
        "Cuantos_empleados_tiene_la_empresa" => "26-50"
        "Tienes_proyecto_por_implementar" => "en 6 meses"
        "En_qu_servicio_est_interesado" => "nube"
      ]
    ]
  ]
  -requestType: "POST"
  -userAgent: "ZohoCRM PHP SDK"
  -apiKey: null
  -isBulkRequest: true
}

非常感谢您的帮助。

0 个答案:

没有答案