Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableMetaQuery::is_operator_compatible_with_shared_join()
Checks whether two meta_query clauses can share a JOIN.
Method of the class: OrdersTableMetaQuery{}
No Hooks.
Return
true|false
. TRUE if the clauses can share a table alias, FALSE otherwise.
Usage
// private - for code of main (parent) class only $result = $this->is_operator_compatible_with_shared_join( $clause, $sibling, $relation ): bool;
- $clause(array) (required)
- An atomic meta_query clause.
- $sibling(array) (required)
- An atomic meta_query clause.
- $relation(string)
- The relation involving both clauses.
Default: 'AND'
OrdersTableMetaQuery::is_operator_compatible_with_shared_join() OrdersTableMetaQuery::is operator compatible with shared join code WC 9.7.1
private function is_operator_compatible_with_shared_join( array $clause, array $sibling, string $relation = 'AND' ): bool { if ( ! $this->is_atomic( $clause ) || ! $this->is_atomic( $sibling ) ) { return false; } $valid_operators = array(); if ( 'OR' === $relation ) { $valid_operators = array( '=', 'IN', 'BETWEEN', 'LIKE', 'REGEXP', 'RLIKE', '>', '>=', '<', '<=' ); } elseif ( isset( $sibling['key'] ) && isset( $clause['key'] ) && $sibling['key'] === $clause['key'] ) { $valid_operators = array( '!=', 'NOT IN', 'NOT LIKE' ); } return in_array( strtoupper( $clause['compare'] ), $valid_operators, true ) && in_array( strtoupper( $sibling['compare'] ), $valid_operators, true ); }