@@ 182-197 (lines=16) @@ | ||
179 | * @return bool |
|
180 | * @throws SalesforceException |
|
181 | */ |
|
182 | public function create($params) |
|
183 | { |
|
184 | $response = $this->sendRequest('POST', "/sobjects/$type", [ |
|
185 | 'json' => $data, |
|
186 | ]); |
|
187 | ||
188 | if (!$response) { |
|
189 | return false; |
|
190 | } |
|
191 | ||
192 | if ($response->success !== true) { |
|
193 | throw new SalesforceException($response->errors); |
|
194 | } |
|
195 | ||
196 | return $response; |
|
197 | } |
|
198 | ||
199 | /** |
|
200 | * Delete a given record |
|
@@ 207-220 (lines=14) @@ | ||
204 | * @return bool |
|
205 | * @throws SalesforceException |
|
206 | */ |
|
207 | public function delete(string $type, string $id) |
|
208 | { |
|
209 | $response = $this->sendRequest('DELETE', "/sobjects/$type/$id"); |
|
210 | ||
211 | if (!$response) { |
|
212 | return false; |
|
213 | } |
|
214 | ||
215 | if ($response->success !== true) { |
|
216 | throw new SalesforceException($response->errors); |
|
217 | } |
|
218 | ||
219 | return $response; |
|
220 | } |
|
221 | ||
222 | } |
|
223 |