Automattic\WooCommerce\Database\Migrations
MetaToMetaTableMigrator::process_migration_data()
Process migration data for a batch of entities.
Method of the class: MetaToMetaTableMigrator{}
No Hooks.
Return
Array
. Array of errors and exception if any.
Usage
$MetaToMetaTableMigrator = new MetaToMetaTableMigrator(); $MetaToMetaTableMigrator->process_migration_data( $data );
- $data(array) (required)
- Data to be migrated. Should be of the form: array( 'data' => array( ... ) ) as returned by the fetch_sanitized_migration_data method.
MetaToMetaTableMigrator::process_migration_data() MetaToMetaTableMigrator::process migration data code WC 9.7.1
public function process_migration_data( array $data ) { if ( isset( $data['data'] ) ) { $data = $data['data']; } $this->clear_errors(); $exception = null; $to_insert = $data[0]; $to_update = $data[1]; try { if ( ! empty( $to_insert ) ) { $insert_queries = $this->generate_insert_sql_for_batch( $to_insert ); $processed_rows_count = $this->db_query( $insert_queries ); $this->maybe_add_insert_or_update_error( 'insert', $processed_rows_count ); } if ( ! empty( $to_update ) ) { $update_queries = $this->generate_update_sql_for_batch( $to_update ); $processed_rows_count = $this->db_query( $update_queries ); $this->maybe_add_insert_or_update_error( 'update', $processed_rows_count ); } } catch ( \Exception $e ) { $exception = $e; } return array( 'errors' => $this->get_errors(), 'exception' => $exception, ); }