SugarCRM:未定义的偏移量:1

时间:2015-03-30 09:19:26

标签: php api laravel-4 sugarcrm

我有来自https://github.com/asakusuma/SugarCRM-REST-API-Wrapper-Class

的糖示例代码
    $sugar = new \Asakusuma\SugarWrapper\Rest;

    $sugar->setUrl('https://sugarcrm/service/v2/rest.php');
    $sugar->setUsername('*******@gmail.com');
    $sugar->setPassword('*****');

    $sugar->connect();

    $error = $sugar->get_error();
    if($error !== FALSE) {
        return $error['name'];
    }
    $results = $sugar->get_with_related("Accounts", array("Accounts" => array('id','name'), "Cases" => array('id','status')));
    $sugar->print_results($results);

错误是Undefined offset:1

我将它与laravel 4.2集成在一起

1 个答案:

答案 0 :(得分:0)

do this

$sugar->setUrl('http://127.0.0.1/mycrm/service/v4_1/rest.php');
$sugar->setUsername('foo');
$sugar->setPassword('bar');
$sugar->connect();

i assume your setUrl is the address where you crm resides.

$results = $sugar->get_with_related("Accounts", array("Accounts" => array('id','name'), "Cases" => array('id','status')));
    $sugar->print_results($results);