Automattic\WooCommerce\Internal\Admin\Reports

HposLegacyOrderReportQueryBuilder::resolve_type_joins │ private │ WC 1.0

Resolve the JOINs required by a data or where row's type, without any SELECT part.

Method of the class: HposLegacyOrderReportQueryBuilder{}

No Hooks.

Returns

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

Usage

// private - for code of main (parent) class only
$result = $this->resolve_type_joins( $raw_key, $value ): array;
$raw_key(string|int) (required)
Key of the row in its original array (a numeric index for where rows).
$value(array) (required)
The row.

HposLegacyOrderReportQueryBuilder::resolve_type_joins() code WC 11.1.2

private function resolve_type_joins( $raw_key, array $value ): array {
	$raw_key   = (string) $raw_key;
	$key       = sanitize_key( $raw_key );
	$join_type = $value['join_type'] ?? 'INNER';

	switch ( $value['type'] ?? '' ) {
		case 'meta':
			return $this->resolve_meta_select( $raw_key, $key, $join_type )[1];
		case 'parent_meta':
			return $this->resolve_parent_meta_select( $raw_key, $key, $join_type )[1];
		case 'order_item_meta':
			return $this->build_order_item_meta_joins( $key, $raw_key, $value['order_item_type'] ?? '', $join_type );
		case 'order_item':
			return $this->build_order_items_join( $join_type );
	}

	return array();
}