Automattic\WooCommerce\Internal\Admin\Reports

HposLegacyOrderReportQueryBuilder::build_meta_join │ private │ WC 1.0

Build the JOIN onto the orders-meta table for an order meta lookup.

Method of the class: HposLegacyOrderReportQueryBuilder{}

No Hooks.

Returns

array<string,string>. JOIN keyed by alias.

Usage

// private - for code of main (parent) class only
$result = $this->build_meta_join( $key, $raw_key, $join_type );
$key(string) (required)
Sanitized meta key for the alias.
$raw_key(string) (required)
Original meta key.
$join_type(string) (required)
Join type.

HposLegacyOrderReportQueryBuilder::build_meta_join() code WC 11.1.2

private function build_meta_join( $key, $raw_key, $join_type ) {
	$alias = "meta_{$key}";
	return array(
		$alias => "{$join_type} JOIN " . OrderUtil::get_table_for_order_meta() . " AS {$alias} ON ( orders.id = {$alias}.order_id AND {$alias}.meta_key = '{$raw_key}' )",
	);
}