Automattic\WooCommerce\Database\Migrations\CustomOrderTable
CLIRunner::normalize_raw_meta_data()
Helper method to normalize response from meta queries into order_id > meta_key > meta_values.
Метод класса: CLIRunner{}
Хуков нет.
Возвращает
Массив
. Normalized data.
Использование
// private - только в коде основоного (родительского) класса $result = $this->normalize_raw_meta_data( $data ): array;
- $data(массив) (обязательный)
- Data fetched from meta queries.
Код CLIRunner::normalize_raw_meta_data() CLIRunner::normalize raw meta data WC 9.2.3
private function normalize_raw_meta_data( array $data ): array { $clubbed_data = array(); foreach ( $data as $row ) { if ( ! isset( $clubbed_data[ $row['entity_id'] ] ) ) { $clubbed_data[ $row['entity_id'] ] = array(); } if ( ! isset( $clubbed_data[ $row['entity_id'] ][ $row['meta_key'] ] ) ) { $clubbed_data[ $row['entity_id'] ][ $row['meta_key'] ] = array(); // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Not a meta query. } $clubbed_data[ $row['entity_id'] ][ $row['meta_key'] ][] = $row['meta_value']; } return $clubbed_data; }