@@ 198-213 (lines=16) @@ | ||
195 | * @return bool |
|
196 | * @throws SalesforceException |
|
197 | */ |
|
198 | public function create(array $params) |
|
199 | { |
|
200 | $response = $this->sendRequest('POST', "/sobject/" . $this->getType(), [ |
|
201 | 'json' => $params, |
|
202 | ]); |
|
203 | ||
204 | if (!$response) { |
|
205 | return false; |
|
206 | } |
|
207 | ||
208 | if ($response->success !== true) { |
|
209 | throw new SalesforceException($response->errors); |
|
210 | } |
|
211 | ||
212 | return $response; |
|
213 | } |
|
214 | ||
215 | /** |
|
216 | * Delete a given record |
|
@@ 222-235 (lines=14) @@ | ||
219 | * @return bool |
|
220 | * @throws SalesforceException |
|
221 | */ |
|
222 | public function delete(string $id) |
|
223 | { |
|
224 | $response = $this->sendRequest('DELETE', "/sobjects/" . $this->getType() ."/$id"); |
|
225 | ||
226 | if (!$response) { |
|
227 | return false; |
|
228 | } |
|
229 | ||
230 | if ($response->success !== true) { |
|
231 | throw new SalesforceException($response->errors); |
|
232 | } |
|
233 | ||
234 | return $response; |
|
235 | } |
|
236 | ||
237 | protected function getType() |
|
238 | { |