Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableMetaQuery::process()privateWC 1.0

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() WC 6.9.4

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 ),
			)
		);
	} else {
		// Nested.
		$relation = $arg['relation'];
		unset( $arg['relation'] );

		foreach ( $arg as $key => &$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;
}