Automattic\WooCommerce\Internal\ProductAttributesLookup

CLIRunner::get_lookup_table_info()privateWC 1.0

Get information about the product attributes lookup table.

Method of the class: CLIRunner{}

No Hooks.

Return

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() code WC 9.3.3

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] ),
	);
}