Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableDataStore::set_order_props_from_data()
Sets order properties based on a row from the database.
Метод класса: OrdersTableDataStore{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->set_order_props_from_data( $order, $order_data );
- $order(\WC_Abstract_Order) (обязательный) (передается по ссылке — &)
- The order object.
- $order_data(объект) (обязательный)
- A row of order data from the database.
Код OrdersTableDataStore::set_order_props_from_data() OrdersTableDataStore::set order props from data WC 9.3.3
protected 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; } try { if ( 'date' === $prop_details['type'] ) { $prop_value = $this->string_to_timestamp( $prop_value ); } $this->set_order_prop( $order, $prop_details['name'], $prop_value ); } catch ( \Exception $e ) { $order_id = $order->get_id(); $this->error_logger->warning( sprintf( /* translators: %1$d = peoperty name, %2$d = order ID, %3$s = error message. */ __( 'Error when setting property \'%1$s\' for order %2$d: %3$s', 'woocommerce' ), $prop_details['name'], $order_id, $e->getMessage() ), array( 'exception_code' => $e->getCode(), 'exception_msg' => $e->getMessage(), 'origin' => __METHOD__, 'order_id' => $order_id, 'property_name' => $prop_details['name'], ) ); } } } }