Automattic\WooCommerce\Database\Migrations
MetaToCustomTableMigrator::process_update_batch
Process batch for update into destination table.
Method of the class: MetaToCustomTableMigrator{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->process_update_batch( $batch, $ids_mapping ): void;
- $batch(array) (required)
- Data to insert, will be of the form as returned by
datainfetch_data_for_migration_for_ids. - $ids_mapping(array) (required)
- Maps rows to update data with their original IDs.
MetaToCustomTableMigrator::process_update_batch() MetaToCustomTableMigrator::process update batch code WC 10.5.0
private function process_update_batch( array $batch, array $ids_mapping ): void {
if ( 0 === count( $batch ) ) {
return;
}
$queries = $this->generate_update_sql_for_batch( $batch, $ids_mapping );
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Queries should already be prepared.
$processed_rows_count = $this->db_query( $queries ) / 2;
$this->maybe_add_insert_or_update_error( 'update', $processed_rows_count );
}