|
@@ 197-208 (lines=12) @@
|
| 194 |
|
* Insert data into the database. |
| 195 |
|
* @since 2.7.0 |
| 196 |
|
*/ |
| 197 |
|
public function create() { |
| 198 |
|
global $wpdb; |
| 199 |
|
|
| 200 |
|
$wpdb->insert( $wpdb->prefix . 'woocommerce_order_items', array( |
| 201 |
|
'order_item_name' => $this->get_name(), |
| 202 |
|
'order_item_type' => $this->get_type(), |
| 203 |
|
'order_id' => $this->get_order_id() |
| 204 |
|
) ); |
| 205 |
|
$this->set_id( $wpdb->insert_id ); |
| 206 |
|
|
| 207 |
|
do_action( 'woocommerce_new_order_item', $this->get_id(), $this, $this->get_order_id() ); |
| 208 |
|
} |
| 209 |
|
|
| 210 |
|
/** |
| 211 |
|
* Update data in the database. |
|
@@ 214-224 (lines=11) @@
|
| 211 |
|
* Update data in the database. |
| 212 |
|
* @since 2.7.0 |
| 213 |
|
*/ |
| 214 |
|
public function update() { |
| 215 |
|
global $wpdb; |
| 216 |
|
|
| 217 |
|
$wpdb->update( $wpdb->prefix . 'woocommerce_order_items', array( |
| 218 |
|
'order_item_name' => $this->get_name(), |
| 219 |
|
'order_item_type' => $this->get_type(), |
| 220 |
|
'order_id' => $this->get_order_id() |
| 221 |
|
), array( 'order_item_id' => $this->get_id() ) ); |
| 222 |
|
|
| 223 |
|
do_action( 'woocommerce_update_order_item', $this->get_id(), $this, $this->get_order_id() ); |
| 224 |
|
} |
| 225 |
|
|
| 226 |
|
/** |
| 227 |
|
* Read from the database. |