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{}

Хуков нет.

Возвращает

Строку. WHERE clause.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_where_clause_for_verification( $source_ids );
$source_ids(массив) (обязательный)
Array of IDs from source table.

Код MetaToCustomTableMigrator::get_where_clause_for_verification() WC 6.8.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
	);
}