Many thanks for your API Mapper.
You may add some code to address the "Next Query Function" of the salesforce API.
It is missing, isn't it?
For example something like this:
Added: protected $nextRecordsUrl:
class CRUD
{
protected $instance_url;
protected $access_token;
+ protected $nextRecordsUrl;
public function __construct()
{
if (!isset($_SESSION) and !isset($_SESSION['salesforce'])) {
throw new \Exception('Access Denied', 403);
}
$this->instance_url = $_SESSION['salesforce']['instance_url'];
$this->access_token = $_SESSION['salesforce']['access_token'];
+ $this->setNextRecordsUrl('');
}
+ public function setNextRecordsUrl($url){
+ $this->nextRecordsUrl = $url;
+ }
public function query($query)
{
$url = "$this->instance_url/services/data/v39.0/query";
+ if($this->nextRecordsUrl)
+ $url = $this->instance_url . $this->nextRecordsUrl;
FYI: This is how I use the additional syntax:
$crud = new \bjsmasth\Salesforce\CRUD();
$data = $crud->query($query);
if($data['totalSize'] > 2000) {
$crud->setNextRecordsUrl($data['nextRecordsUrl']);
$additionalRequestsNeeded = ceil($data['totalSize'] / 2000) -1;
for ($i=0; $i < $additionalRequestsNeeded; $i++) {
$data['records'] = array_merge($data['records'], ($crud->query($query))['records']);
}
}
Many thanks for your API Mapper.
You may add some code to address the "Next Query Function" of the salesforce API.
It is missing, isn't it?
For example something like this:
Added: protected $nextRecordsUrl:
FYI: This is how I use the additional syntax: