Query.php
49 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Class for parameter-based downloads Reports querying |
| 4 | */ |
| 5 | |
| 6 | namespace Automattic\WooCommerce\Admin\API\Reports\Downloads\Stats; |
| 7 | |
| 8 | defined( 'ABSPATH' ) || exit; |
| 9 | |
| 10 | use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery; |
| 11 | |
| 12 | /** |
| 13 | * API\Reports\Downloads\Stats\Query |
| 14 | * |
| 15 | * @deprecated 9.3.0 Downloads\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly. |
| 16 | */ |
| 17 | class Query extends ReportsQuery { |
| 18 | |
| 19 | /** |
| 20 | * Valid fields for Orders report. |
| 21 | * |
| 22 | * @deprecated 9.3.0 Downloads\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly. |
| 23 | * |
| 24 | * @return array |
| 25 | */ |
| 26 | protected function get_default_query_vars() { |
| 27 | wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' ); |
| 28 | |
| 29 | return array(); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Get revenue data based on the current query vars. |
| 34 | * |
| 35 | * @deprecated 9.3.0 Downloads\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly. |
| 36 | * |
| 37 | * @return array |
| 38 | */ |
| 39 | public function get_data() { |
| 40 | wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' ); |
| 41 | |
| 42 | $args = apply_filters( 'woocommerce_analytics_downloads_stats_query_args', $this->get_query_vars() ); |
| 43 | |
| 44 | $data_store = \WC_Data_Store::load( 'report-downloads-stats' ); |
| 45 | $results = $data_store->get_data( $args ); |
| 46 | return apply_filters( 'woocommerce_analytics_downloads_stats_select_query', $results, $args ); |
| 47 | } |
| 48 | } |
| 49 |