Automattic\WooCommerce\Internal\Admin\Reports

HposLegacyOrderReportQueryBuilder::build_parent_meta_join │ private │ WC 1.0

Build the JOIN onto the orders-meta table keyed on the parent order id.

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_parent_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_parent_meta_join() code WC 11.1.2

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