| @@ 109-115 (lines=7) @@ | ||
| 106 | public function __construct( $read = 0 ) { |
|
| 107 | parent::__construct( $read ); |
|
| 108 | ||
| 109 | if ( is_numeric( $read ) && $read > 0 ) { |
|
| 110 | $this->read( $read ); |
|
| 111 | } elseif ( $read instanceof self ) { |
|
| 112 | $this->read( absint( $read->get_id() ) ); |
|
| 113 | } elseif ( ! empty( $read->ID ) ) { |
|
| 114 | $this->read( absint( $read->ID ) ); |
|
| 115 | } |
|
| 116 | // Set default status if none were read. |
|
| 117 | if ( ! $this->get_status() ) { |
|
| 118 | $this->set_status( apply_filters( 'woocommerce_default_order_status', 'pending' ) ); |
|
| @@ 585-591 (lines=7) @@ | ||
| 582 | */ |
|
| 583 | protected function init( $order ) { |
|
| 584 | _deprecated_function( 'init', '2.7', 'Logic moved to constructor' ); |
|
| 585 | if ( is_numeric( $order ) ) { |
|
| 586 | $this->read( $order ); |
|
| 587 | } elseif ( $order instanceof WC_Order ) { |
|
| 588 | $this->read( absint( $order->get_id() ) ); |
|
| 589 | } elseif ( isset( $order->ID ) ) { |
|
| 590 | $this->read( absint( $order->ID ) ); |
|
| 591 | } |
|
| 592 | } |
|
| 593 | ||
| 594 | /** |
|