Automattic\WooCommerce\Internal\Admin\Reports

HposLegacyOrderReportQueryBuilder::translate_post_column │ private │ WC 1.0

Translate a post_data column key to an HPOS column reference.

Метод класса: HposLegacyOrderReportQueryBuilder{}

Хуков нет.

Возвращает

string. SQL fragment referencing the equivalent HPOS column.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->translate_post_column( $key ): string;
$key(строка) (обязательный)
Sanitized post_data key from the caller.

Код HposLegacyOrderReportQueryBuilder::translate_post_column() WC 11.2.2

private function translate_post_column( string $key ): string {
	$map = $this->legacy_to_hpos_column_map();

	// `sanitize_key()` lowercases `ID` to `id`; treat both forms as the orders.id column.
	if ( 'id' === $key ) {
		return $map['ID'];
	}
	return $map[ $key ] ?? "orders.{$key}";
}