Automattic\WooCommerce\Database\Migrations\CustomOrderTable
PostsToOrdersMigrationController::migrate_orders()
Migrates a set of orders from the posts table to the custom orders tables.
Метод класса: PostsToOrdersMigrationController{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$PostsToOrdersMigrationController = new PostsToOrdersMigrationController(); $PostsToOrdersMigrationController->migrate_orders( $order_post_ids ): void;
- $order_post_ids(массив) (обязательный)
- List of post IDs of the orders to migrate.
Код PostsToOrdersMigrationController::migrate_orders() PostsToOrdersMigrationController::migrate orders WC 9.3.1
public function migrate_orders( array $order_post_ids ): void { $this->error_logger = WC()->call_function( 'wc_get_logger' ); $data = array(); try { foreach ( $this->all_migrators as $name => $migrator ) { $data[ $name ] = $migrator->fetch_sanitized_migration_data( $order_post_ids ); if ( ! empty( $data[ $name ]['errors'] ) ) { $this->handle_migration_error( $order_post_ids, $data[ $name ]['errors'], null, null, $name ); return; } } } catch ( \Exception $e ) { $this->handle_migration_error( $order_post_ids, $data, $e, null, 'Fetching data' ); return; } $using_transactions = $this->maybe_start_transaction(); foreach ( $this->all_migrators as $name => $migrator ) { $results = $migrator->process_migration_data( $data[ $name ] ); $errors = array_unique( $results['errors'] ); $exception = $results['exception']; if ( null === $exception && empty( $errors ) ) { continue; } $this->handle_migration_error( $order_post_ids, $errors, $exception, $using_transactions, $name ); return; } if ( $using_transactions ) { $this->commit_transaction(); } }