Automattic\WooCommerce\Internal
OrderCouponDataMigrator::process_batch
Process data for the supplied batch. See the convert_item method.
Метод класса: OrderCouponDataMigrator{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$OrderCouponDataMigrator = new OrderCouponDataMigrator(); $OrderCouponDataMigrator->process_batch( $batch ): void;
- $batch(массив) (обязательный)
- Batch to process, as returned by
'get_next_batch_to_process'.
Код OrderCouponDataMigrator::process_batch() OrderCouponDataMigrator::process batch WC 10.7.0
public function process_batch( array $batch ): void {
global $wpdb;
if ( empty( $batch ) ) {
return;
}
$meta_ids = StringUtil::to_sql_list( $batch );
$meta_ids_and_values = $wpdb->get_results(
//phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
"SELECT meta_id,meta_value FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE meta_id IN $meta_ids",
ARRAY_N
);
foreach ( $meta_ids_and_values as $meta_id_and_value ) {
try {
$this->convert_item( (int) $meta_id_and_value[0], $meta_id_and_value[1] );
} catch ( Exception $ex ) {
wc_get_logger()->error( StringUtil::class_name_without_namespace( self::class ) . ": when converting meta row with id {$meta_id_and_value[0]}: {$ex->getMessage()}" );
}
}
}