Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::set_order_props_from_data()privateWC 1.0

Sets order properties based on a row from the database.

Метод класса: OrdersTableDataStore{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->set_order_props_from_data( $order, $order_data );
$order(\WC_Abstract_Order) (required) (passed by reference — &)
The order object.
$order_data(object) (required)
A row of order data from the database.

Код OrdersTableDataStore::set_order_props_from_data() WC 7.1.0

private function set_order_props_from_data( &$order, $order_data ) {
	foreach ( $this->get_all_order_column_mappings() as $table_name => $column_mapping ) {
		foreach ( $column_mapping as $column_name => $prop_details ) {
			if ( ! isset( $prop_details['name'] ) ) {
				continue;
			}
			$prop_value = $order_data->{$prop_details['name']};
			if ( is_null( $prop_value ) ) {
				continue;
			}

			if ( 'date' === $prop_details['type'] ) {
				$prop_value = $this->string_to_timestamp( $prop_value );
			}

			$this->set_order_prop( $order, $prop_details['name'], $prop_value );
		}
	}
}