@@ 216-223 (lines=8) @@ | ||
213 | true |
|
214 | ); |
|
215 | $model_obj = $model->get_one_by_ID($obj_id); |
|
216 | if (! $model_obj instanceof EE_Base_Class) { |
|
217 | $lowercase_model_name = strtolower($model->get_this_model_name()); |
|
218 | throw new RestException( |
|
219 | sprintf('rest_%s_invalid_id', $lowercase_model_name), |
|
220 | sprintf(__('Invalid %s ID.', 'event_espresso'), $lowercase_model_name), |
|
221 | array('status' => 404) |
|
222 | ); |
|
223 | } |
|
224 | $model_obj->save($model_data); |
|
225 | return $this->returnModelObjAsJsonResponse($model_obj, $request); |
|
226 | } |
|
@@ 259-266 (lines=8) @@ | ||
256 | $obj_id = $request->get_param('id'); |
|
257 | // this is where we would apply more fine-grained caps |
|
258 | $model_obj = $model->get_one_by_ID($obj_id); |
|
259 | if (! $model_obj instanceof EE_Base_Class) { |
|
260 | $lowercase_model_name = strtolower($model->get_this_model_name()); |
|
261 | throw new RestException( |
|
262 | sprintf('rest_%s_invalid_id', $lowercase_model_name), |
|
263 | sprintf(__('Invalid %s ID.', 'event_espresso'), $lowercase_model_name), |
|
264 | array('status' => 404) |
|
265 | ); |
|
266 | } |
|
267 | $requested_permanent_delete = filter_var($request->get_param('force'), FILTER_VALIDATE_BOOLEAN); |
|
268 | $requested_allow_blocking = filter_var($request->get_param('allow_blocking'), FILTER_VALIDATE_BOOLEAN); |
|
269 | if ($requested_permanent_delete) { |