Automattic\WooCommerce\Internal\ProductAttributesLookup
CLIRunner::get_lookup_table_info
Get information about the product attributes lookup table.
Method of the class: CLIRunner{}
No Hooks.
Returns
Array. Array containing the 'total_rows' and 'products_count' keys.
Usage
// private - for code of main (parent) class only $result = $this->get_lookup_table_info(): array;
CLIRunner::get_lookup_table_info() CLIRunner::get lookup table info code WC 10.3.6
private function get_lookup_table_info(): array {
global $wpdb;
$table_name = $this->lookup_data_store->get_lookup_table_name();
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$info = $wpdb->get_row( 'select count(1), count(distinct(product_or_parent_id)) from ' . $table_name, ARRAY_N );
return array(
'total_rows' => absint( $info[0] ),
'products_count' => absint( $info[1] ),
);
}