2016-11-08 09:39:47 +00:00
|
|
|
<?php
|
2018-03-06 09:34:16 +00:00
|
|
|
/**
|
|
|
|
* Object Data Store Interface
|
|
|
|
*
|
|
|
|
* @version 3.0.0
|
|
|
|
* @package WooCommerce/Interface
|
|
|
|
*/
|
|
|
|
|
2016-11-08 09:39:47 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WC Data Store Interface
|
|
|
|
*
|
2017-03-15 16:36:53 +00:00
|
|
|
* @version 3.0.0
|
2016-11-08 09:39:47 +00:00
|
|
|
*/
|
2016-11-22 13:54:51 +00:00
|
|
|
interface WC_Object_Data_Store_Interface {
|
2016-11-08 09:39:47 +00:00
|
|
|
/**
|
|
|
|
* Method to create a new record of a WC_Data based object.
|
2018-03-06 09:34:16 +00:00
|
|
|
*
|
|
|
|
* @param WC_Data $data Data object.
|
2016-11-08 09:39:47 +00:00
|
|
|
*/
|
|
|
|
public function create( &$data );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to read a record. Creates a new WC_Data based object.
|
2018-03-06 09:34:16 +00:00
|
|
|
*
|
|
|
|
* @param WC_Data $data Data object.
|
2016-11-08 09:39:47 +00:00
|
|
|
*/
|
|
|
|
public function read( &$data );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates a record in the database.
|
2018-03-06 09:34:16 +00:00
|
|
|
*
|
|
|
|
* @param WC_Data $data Data object.
|
2016-11-08 09:39:47 +00:00
|
|
|
*/
|
|
|
|
public function update( &$data );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deletes a record from the database.
|
2018-03-06 09:34:16 +00:00
|
|
|
*
|
|
|
|
* @param WC_Data $data Data object.
|
|
|
|
* @param array $args Array of args to pass to the delete method.
|
2016-11-15 18:11:25 +00:00
|
|
|
* @return bool result
|
2016-11-08 09:39:47 +00:00
|
|
|
*/
|
2016-11-15 19:35:10 +00:00
|
|
|
public function delete( &$data, $args = array() );
|
2016-11-21 23:48:49 +00:00
|
|
|
|
2016-11-22 11:34:14 +00:00
|
|
|
/**
|
|
|
|
* Returns an array of meta for an object.
|
2018-03-06 09:34:16 +00:00
|
|
|
*
|
|
|
|
* @param WC_Data $data Data object.
|
2016-11-22 11:34:14 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
2016-11-21 23:48:49 +00:00
|
|
|
public function read_meta( &$data );
|
|
|
|
|
2016-11-22 11:34:14 +00:00
|
|
|
/**
|
|
|
|
* Deletes meta based on meta ID.
|
2018-03-06 09:34:16 +00:00
|
|
|
*
|
|
|
|
* @param WC_Data $data Data object.
|
|
|
|
* @param object $meta Meta object (containing at least ->id).
|
2016-11-22 11:34:14 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
2016-11-21 23:48:49 +00:00
|
|
|
public function delete_meta( &$data, $meta );
|
|
|
|
|
2016-11-22 11:34:14 +00:00
|
|
|
/**
|
|
|
|
* Add new piece of meta.
|
2018-03-06 09:34:16 +00:00
|
|
|
*
|
|
|
|
* @param WC_Data $data Data object.
|
|
|
|
* @param object $meta Meta object (containing ->key and ->value).
|
2017-03-28 17:52:32 +00:00
|
|
|
* @return int meta ID
|
2016-11-22 11:34:14 +00:00
|
|
|
*/
|
2016-11-21 23:48:49 +00:00
|
|
|
public function add_meta( &$data, $meta );
|
|
|
|
|
2016-11-22 11:34:14 +00:00
|
|
|
/**
|
|
|
|
* Update meta.
|
2018-03-06 09:34:16 +00:00
|
|
|
*
|
|
|
|
* @param WC_Data $data Data object.
|
|
|
|
* @param object $meta Meta object (containing ->id, ->key and ->value).
|
2016-11-22 11:34:14 +00:00
|
|
|
*/
|
2016-11-21 23:48:49 +00:00
|
|
|
public function update_meta( &$data, $meta );
|
2016-11-08 09:39:47 +00:00
|
|
|
}
|