|
@@ 287-315 (lines=29) @@
|
| 284 |
|
* |
| 285 |
|
* @throws ZohoCRMResponseException |
| 286 |
|
*/ |
| 287 |
|
public function getRecords($sortColumnString = null, $sortOrderString = null, \DateTime $lastModifiedTime = null, $selectColumns = null, $limit = null) |
| 288 |
|
{ |
| 289 |
|
$globalResponse = array(); |
| 290 |
|
|
| 291 |
|
do { |
| 292 |
|
try { |
| 293 |
|
$fromIndex = count($globalResponse) + 1; |
| 294 |
|
$toIndex = $fromIndex + self::MAX_GET_RECORDS - 1; |
| 295 |
|
|
| 296 |
|
if ($limit) { |
| 297 |
|
$toIndex = min($limit, $toIndex); |
| 298 |
|
} |
| 299 |
|
|
| 300 |
|
$response = $this->zohoClient->getRecords($this->getModule(), $sortColumnString, $sortOrderString, $lastModifiedTime, $selectColumns, $fromIndex, $toIndex); |
| 301 |
|
$beans = $this->getBeansFromResponse($response); |
| 302 |
|
} catch (ZohoCRMResponseException $e) { |
| 303 |
|
// No records found? Let's return an empty array! |
| 304 |
|
if ($e->getCode() == 4422) { |
| 305 |
|
$beans = array(); |
| 306 |
|
} else { |
| 307 |
|
throw $e; |
| 308 |
|
} |
| 309 |
|
} |
| 310 |
|
|
| 311 |
|
$globalResponse = array_merge($globalResponse, $beans); |
| 312 |
|
} while (count($beans) == self::MAX_GET_RECORDS); |
| 313 |
|
|
| 314 |
|
return $globalResponse; |
| 315 |
|
} |
| 316 |
|
|
| 317 |
|
/** |
| 318 |
|
* Returns the list of deleted records. |
|
@@ 411-439 (lines=29) @@
|
| 408 |
|
* |
| 409 |
|
* @throws ZohoCRMResponseException |
| 410 |
|
*/ |
| 411 |
|
public function searchRecords($searchCondition = null, $limit = null, \DateTime $lastModifiedTime = null, $selectColumns = null) |
| 412 |
|
{ |
| 413 |
|
$globalResponse = array(); |
| 414 |
|
|
| 415 |
|
do { |
| 416 |
|
try { |
| 417 |
|
$fromIndex = count($globalResponse) + 1; |
| 418 |
|
$toIndex = $fromIndex + self::MAX_GET_RECORDS - 1; |
| 419 |
|
|
| 420 |
|
if ($limit) { |
| 421 |
|
$toIndex = min($limit - 1, $toIndex); |
| 422 |
|
} |
| 423 |
|
|
| 424 |
|
$response = $this->zohoClient->searchRecords($this->getModule(), $searchCondition, $fromIndex, $toIndex, $lastModifiedTime, $selectColumns); |
| 425 |
|
$beans = $this->getBeansFromResponse($response); |
| 426 |
|
} catch (ZohoCRMResponseException $e) { |
| 427 |
|
// No records found? Let's return an empty array! |
| 428 |
|
if ($e->getCode() == 4422) { |
| 429 |
|
$beans = array(); |
| 430 |
|
} else { |
| 431 |
|
throw $e; |
| 432 |
|
} |
| 433 |
|
} |
| 434 |
|
|
| 435 |
|
$globalResponse = array_merge($globalResponse, $beans); |
| 436 |
|
} while (count($beans) == self::MAX_GET_RECORDS); |
| 437 |
|
|
| 438 |
|
return $globalResponse; |
| 439 |
|
} |
| 440 |
|
|
| 441 |
|
/** |
| 442 |
|
* Implements insertRecords API method. |