Skip to content
Snippets Groups Projects
Commit 56315568 authored by Aaron Bauman's avatar Aaron Bauman
Browse files

Issue #1992260 by aaronbauman - Preserve original upsert response when...

Issue #1992260 by aaronbauman - Preserve original upsert response when fetching object ID after update
parent 60905a8f
No related branches found
No related tags found
No related merge requests found
...@@ -593,10 +593,15 @@ class RestClient { ...@@ -593,10 +593,15 @@ class RestClient {
// On update, upsert method returns an empty body. Retreive object id, so that we can return a consistent response. // On update, upsert method returns an empty body. Retreive object id, so that we can return a consistent response.
if ($this->response->getStatusCode() == 204) { if ($this->response->getStatusCode() == 204) {
// We need a way to allow callers to distinguish updates and inserts. To
// that end, cache the original response and reset it after fetching the
// ID.
$response = $this->response;
$sf_object = $this->objectReadbyExternalId($name, $key, $value); $sf_object = $this->objectReadbyExternalId($name, $key, $value);
$data['id'] = $sf_object['Id']; $data['id'] = $sf_object['Id'];
$data['success'] = TRUE; $data['success'] = TRUE;
$data['errors'] = []; $data['errors'] = [];
$this->response = $response;
} }
return $data; return $data;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment