Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableStatusUnionQuery::where_matches_type_status_argsprivateWC 1.0

Checks the WHERE clause is exactly the one the 'type' and 'status' args generate (same order as OrdersTableQuery::process_orders_table_query_args()). Any other contribution — other query args or filters — disqualifies the query. Both columns are of the 'string' type per the OrdersTableDataStore column mappings.

Method of the class: OrdersTableStatusUnionQuery{}

No Hooks.

Returns

true|false. Whether the WHERE clause is exactly the type/status one.

Usage

// private - for code of main (parent) class only
$result = $this->where_matches_type_status_args( $where ): bool;
$where(string) (required)
The WHERE clause (without the WHERE keyword).

OrdersTableStatusUnionQuery::where_matches_type_status_args() code WC 11.0.0

private function where_matches_type_status_args( string $where ): bool {
	$expected_where = '1=1';
	foreach ( array( 'status', 'type' ) as $arg_key ) {
		$clause          = $this->query->where( $this->orders_table, $arg_key, '=', $this->query->get( $arg_key ), 'string' );
		$expected_where .= " AND ({$clause})";
	}

	return $where === $expected_where;
}