Query.php
30 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Class for stock stats report querying |
| 4 | * |
| 5 | * $report = new \Automattic\WooCommerce\Admin\API\Reports\Stock\Stats\Query(); |
| 6 | * $mydata = $report->get_data(); |
| 7 | */ |
| 8 | |
| 9 | namespace Automattic\WooCommerce\Admin\API\Reports\Stock\Stats; |
| 10 | |
| 11 | defined( 'ABSPATH' ) || exit; |
| 12 | |
| 13 | /** |
| 14 | * API\Reports\Stock\Stats\Query |
| 15 | * This query takes no arguments, so we do not inherit from GenericQuery. |
| 16 | */ |
| 17 | class Query extends \WC_Object_Query { |
| 18 | |
| 19 | /** |
| 20 | * Get product data based on the current query vars. |
| 21 | * |
| 22 | * @return array |
| 23 | */ |
| 24 | public function get_data() { |
| 25 | $data_store = \WC_Data_Store::load( 'report-stock-stats' ); |
| 26 | $results = $data_store->get_data(); |
| 27 | return apply_filters( 'woocommerce_analytics_stock_stats_query', $results ); |
| 28 | } |
| 29 | } |
| 30 |