Automattic\WooCommerce\Database\Migrations
MetaToCustomTableMigrator::get_where_clause_for_verification
Helper function to generate where clause for fetching data for verification.
Method of the class: MetaToCustomTableMigrator{}
No Hooks.
Returns
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.
MetaToCustomTableMigrator::get_where_clause_for_verification() MetaToCustomTableMigrator::get where clause for verification code WC 10.5.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
);
}