Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableFieldQuery::process
Processes field_query entries and generates the necessary table aliases, JOIN statements and WHERE conditions.
Method of the class: OrdersTableFieldQuery{}
No Hooks.
Returns
String. An SQL WHERE statement.
Usage
// private - for code of main (parent) class only $result = $this->process( $q );
- $q(array) (required)
- A field query.
OrdersTableFieldQuery::process() OrdersTableFieldQuery::process code WC 10.7.0
private function process( array $q ) {
$where = '';
if ( empty( $q ) ) {
return $where;
}
if ( $this->is_atomic( $q ) ) {
$q['alias'] = $this->find_or_create_table_alias_for_clause( $q );
$where = $this->generate_where_for_clause( $q );
} else {
$relation = $q['relation'];
unset( $q['relation'] );
$chunks = array();
foreach ( $q as $query ) {
$chunks[] = $this->process( $query );
}
if ( 1 === count( $chunks ) ) {
$where = $chunks[0];
} else {
$where = '(' . implode( " {$relation} ", $chunks ) . ')';
}
}
return $where;
}