Merge pull request #13046 from thenbrent/merge_extra_data

Merge WC_Data::$extra_data in WC_Data::__construct()
This commit is contained in:
Mike Jolley 2017-02-06 13:08:53 +01:00 committed by GitHub
commit 1ef593ff16
5 changed files with 3 additions and 29 deletions

View File

@ -83,6 +83,9 @@ abstract class WC_Data {
* @param int|object|array $read ID to load from the DB (optional) or already queried data.
*/
public function __construct( $read = 0 ) {
$this->data = array_merge( $this->data, $this->extra_data );
$this->default_data = $this->data;
}

View File

@ -57,7 +57,6 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
* @param int|object|array $item ID to load from the DB, or WC_Order_Item Object
*/
public function __construct( $item = 0 ) {
$this->data = array_merge( $this->data, $this->extra_data );
parent::__construct( $item );
if ( $item instanceof WC_Order_Item ) {

View File

@ -38,16 +38,6 @@ class WC_Order_Refund extends WC_Abstract_Order {
'refunded_by' => 0,
);
/**
* Extend the abstract _data properties and then read the order object.
*
* @param int|object|WC_Order $read Order to init.
*/
public function __construct( $read = 0 ) {
$this->data = array_merge( $this->data, $this->extra_data );
parent::__construct( $read );
}
/**
* Get internal type (post type.)
* @return string

View File

@ -26,15 +26,6 @@ class WC_Product_External extends WC_Product {
'button_text' => '',
);
/**
* Merges external product data into the parent object.
* @param int|WC_Product|object $product Product to init.
*/
public function __construct( $product = 0 ) {
$this->data = array_merge( $this->data, $this->extra_data );
parent::__construct( $product );
}
/**
* Get internal type.
* @return string

View File

@ -25,15 +25,6 @@ class WC_Product_Grouped extends WC_Product {
'children' => array(),
);
/**
* Merges grouped product data into the parent object.
* @param int|WC_Product|object $product Product to init.
*/
public function __construct( $product = 0 ) {
$this->data = array_merge( $this->data, $this->extra_data );
parent::__construct( $product );
}
/**
* Get internal type.
* @return string