Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableQuery::process_orderby()
Generates the ORDER BY clause.
Method of the class: OrdersTableQuery{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->process_orderby(): void;
OrdersTableQuery::process_orderby() OrdersTableQuery::process orderby code WC 9.3.3
private function process_orderby(): void { // 'order' and 'orderby' vars. $this->args['order'] = $this->sanitize_order( $this->args['order'] ?? '' ); $this->sanitize_order_orderby(); $orderby = $this->args['orderby']; if ( 'none' === $orderby ) { $this->orderby = ''; return; } if ( 'include' === $orderby || 'post__in' === $orderby ) { $ids = $this->args['id'] ?? $this->args['includes']; if ( empty( $ids ) ) { return; } $ids = array_map( 'absint', $ids ); $this->orderby = array( "FIELD( {$this->tables['orders']}.id, " . implode( ',', $ids ) . ' )' ); return; } $meta_orderby_keys = $this->meta_query ? $this->meta_query->get_orderby_keys() : array(); $orderby_array = array(); foreach ( $this->args['orderby'] as $_orderby => $order ) { if ( in_array( $_orderby, $meta_orderby_keys, true ) ) { $_orderby = $this->meta_query->get_orderby_clause_for_key( $_orderby ); } $orderby_array[] = "{$_orderby} {$order}"; } $this->orderby = $orderby_array; }