WC_REST_CRUD_Controller::prepare_object_for_database()
Prepares one object for create or update operation.
Method of the class: WC_REST_CRUD_Controller{}
No Hooks.
Return
WP_Error|WC_Data
. The prepared item, or WP_Error object on failure.
Usage
// protected - for code of main (parent) or child class $result = $this->prepare_object_for_database( $request, $creating );
- $request(WP_REST_Request) (required)
- Request object.
- $creating(true|false)
- If is creating a new object.
Default: false
Changelog
Since 3.0.0 | Introduced. |
WC_REST_CRUD_Controller::prepare_object_for_database() WC REST CRUD Controller::prepare object for database code WC 9.7.1
protected function prepare_object_for_database( $request, $creating = false ) { // translators: %s: Class method name. return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) ); }