Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableQuery::process_addresses_table_query_args()privateWC 1.0

Processes fields related to the addresses table.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->process_addresses_table_query_args(): void;

Код OrdersTableQuery::process_addresses_table_query_args() WC 8.7.0

private function process_addresses_table_query_args(): void {
	global $wpdb;

	foreach ( array( 'billing', 'shipping' ) as $address_type ) {
		$fields = array_filter(
			array(
				$address_type . '_first_name',
				$address_type . '_last_name',
				$address_type . '_company',
				$address_type . '_address_1',
				$address_type . '_address_2',
				$address_type . '_city',
				$address_type . '_state',
				$address_type . '_postcode',
				$address_type . '_country',
				$address_type . '_phone',
			),
			array( $this, 'arg_isset' )
		);

		if ( ! $fields ) {
			continue;
		}

		$this->join(
			$this->tables['addresses'],
			$address_type,
			$wpdb->prepare( "{$this->tables['orders']}.id = {$address_type}.order_id AND {$address_type}.address_type = %s", $address_type ), // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
			'inner',
			false
		);

		foreach ( $fields as $arg_key ) {
			$column_name = str_replace( "{$address_type}_", '', $arg_key );

			$this->where[] = $this->where(
				$address_type,
				$column_name,
				'=',
				$this->args[ $arg_key ],
				$this->mappings[ "{$address_type}_address" ][ $column_name ]['type']
			);
		}
	}
}