forrest icon indicating copy to clipboard operation
forrest copied to clipboard

Handling nextRecordsUrl

Open jbrown2018 opened this issue 6 years ago • 1 comments
trafficstars

Love the interface you've provided for laravel. One issue I've ran into though is that there is no way to handle the nextRecordsUrl returned from Salesforce in the case of a large result set being returned.

I had to modify the query function in client.php to the following

public function query($query, $options = [], $nextUrl = false)
{
        $url = $this->instanceURLRepo->get();
        $url .= $this->resourceRepo->get('query');
        if ($nextUrl == true) {
            $url .= '/';
        }
        if ($nextUrl == false) {
            $url .= '?q=';
        }
        $url .= urlencode($query);

        $queryResults = $this->request($url, $options);

        return $queryResults;
}

This will allow users to pass in the nextRecordsUrl returned by salesforce to get the next set of records.

jbrown2018 avatar Aug 22 '19 18:08 jbrown2018

Something like that could be built, but I feel that would make this library a little too opinionated.

For instance, there might be situations where an application would like to handle returning the next set of records a certain way.

I'll leave the issue open in case others have input.

omniphx avatar Nov 23 '19 17:11 omniphx