Automattic\WooCommerce\Database\Migrations

MetaToCustomTableMigrator::get_where_clause_for_verification()protectedWC 1.0

Helper function to generate where clause for fetching data for verification.

Метод класса: MetaToCustomTableMigrator{}

No Hooks.

Return

String. WHERE clause.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_where_clause_for_verification( $source_ids );
$source_ids(array) (required)
Array of IDs from source table.

Code of MetaToCustomTableMigrator::get_where_clause_for_verification() WC 7.1.0

protected function get_where_clause_for_verification( $source_ids ) {
	global $wpdb;
	$source_primary_id_column = $this->schema_config['source']['entity']['primary_key'];
	$source_table             = $this->schema_config['source']['entity']['table_name'];
	$source_ids_placeholder   = implode( ', ', array_fill( 0, count( $source_ids ), '%d' ) );

	return $wpdb->prepare(
		// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
		"$source_table.$source_primary_id_column IN ($source_ids_placeholder)",
		$source_ids
	);
}