Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableQuery::__construct()publicWC 1.0

Sets up and runs the query after processing arguments.

Method of the class: OrdersTableQuery{}

No Hooks.

Return

null. Nothing (null).

Usage

$OrdersTableQuery = new OrdersTableQuery();
$OrdersTableQuery->__construct( $args );
$args(array)
Array of query vars.
Default: array()

OrdersTableQuery::__construct() code WC 9.3.3

public function __construct( $args = array() ) {
	// Note that ideally we would inject this dependency via constructor, but that's not possible since this class needs to be backward compatible with WC_Order_Query class.
	$this->order_datastore = wc_get_container()->get( OrdersTableDataStore::class );

	$this->tables   = $this->order_datastore::get_all_table_names_with_id();
	$this->mappings = $this->order_datastore->get_all_order_column_mappings();

	$this->suppress_filters = array_key_exists( 'suppress_filters', $args ) ? (bool) $args['suppress_filters'] : false;
	unset( $args['suppress_filters'] );

	$this->args = $args;

	// TODO: args to be implemented.
	unset( $this->args['customer_note'], $this->args['name'] );

	$this->build_query();
	if ( ! $this->maybe_override_query() ) {
		$this->run_query();
	}
}