Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableMetaQuery::process()
Processes meta_query entries and generates the necessary table aliases, JOIN statements and WHERE conditions.
Метод класса: OrdersTableMetaQuery{}
Хуков нет.
Возвращает
Массив
. A nested array of WHERE conditions.
Использование
// private - только в коде основоного (родительского) класса $result = $this->process( $arg, $parent ): array;
- $arg(массив) (обязательный)
- A meta query.
- $parent(null|массив) (передается по ссылке — &)
- The parent of the element being processed.
По умолчанию: null
Код OrdersTableMetaQuery::process() OrdersTableMetaQuery::process WC 9.3.3
private function process( array &$arg, &$parent = null ): array { $where = array(); if ( $this->is_atomic( $arg ) ) { $arg['alias'] = $this->find_or_create_table_alias_for_clause( $arg, $parent ); $arg['cast'] = $this->sanitize_cast_type( $arg['type'] ?? '' ); $where = array_filter( array( $this->generate_where_for_clause_key( $arg ), $this->generate_where_for_clause_value( $arg ), ) ); // Store clauses by their key for ORDER BY purposes. $flat_clause_key = is_int( $arg['index'] ) ? $arg['alias'] : $arg['index']; $unique_flat_key = $flat_clause_key; $i = 1; while ( isset( $this->flattened_clauses[ $unique_flat_key ] ) ) { $unique_flat_key = $flat_clause_key . '-' . $i; $i++; } $this->flattened_clauses[ $unique_flat_key ] =& $arg; } else { // Nested. $relation = $arg['relation']; unset( $arg['relation'] ); $chunks = array(); foreach ( $arg as $index => &$clause ) { $chunks[] = $this->process( $clause, $arg ); } // Merge chunks of the form OR(m) with the surrounding clause. if ( 1 === count( $chunks ) ) { $where = $chunks[0]; } else { $where = array_merge( array( 'operator' => $relation, ), $chunks ); } } return $where; }