| @@ 208-223 (lines=16) @@ | ||
| 205 | * @return bool | |
| 206 | * @throws SalesforceException | |
| 207 | */ | |
| 208 | public function create(array $params) | |
| 209 |     { | |
| 210 |         $response = $this->sendRequest('POST', "/sobject/" . $this->getType(), [ | |
| 211 | 'json' => $params, | |
| 212 | ]); | |
| 213 | ||
| 214 |         if (!$response) { | |
| 215 | return false; | |
| 216 | } | |
| 217 | ||
| 218 |         if ($response->success !== true) { | |
| 219 | throw new SalesforceException($response->errors); | |
| 220 | } | |
| 221 | ||
| 222 | return $response; | |
| 223 | } | |
| 224 | ||
| 225 | /** | |
| 226 | * Delete a given record | |
| @@ 232-245 (lines=14) @@ | ||
| 229 | * @return bool | |
| 230 | * @throws SalesforceException | |
| 231 | */ | |
| 232 | public function delete(string $id) | |
| 233 |     { | |
| 234 |         $response = $this->sendRequest('DELETE', "/sobjects/" . $this->getType() ."/$id"); | |
| 235 | ||
| 236 |         if (!$response) { | |
| 237 | return false; | |
| 238 | } | |
| 239 | ||
| 240 |         if ($response->success !== true) { | |
| 241 | throw new SalesforceException($response->errors); | |
| 242 | } | |
| 243 | ||
| 244 | return $response; | |
| 245 | } | |
| 246 | ||
| 247 | protected function getType() | |
| 248 |     { | |