Log deprecation warnings for Query class (#50969)

Log deprecation warnings for analytic reports `Automattic\WooCommerce\Admin\API\Reports\Query` class usage.

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Tomek Wytrębowicz 2024-08-28 01:45:04 +02:00 committed by GitHub
parent bd9716a33e
commit deb76cbada
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 123 additions and 57 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
Log deprecation warnings for `Query` class usage.

View File

@ -32,7 +32,7 @@ class Controller extends GenericController implements ExportableInterface {
protected $rest_base = 'reports/categories'; protected $rest_base = 'reports/categories';
/** /**
* Get data from `'categories'` Query. * Get data from `'categories'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -23,7 +23,7 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Categories\Query * API\Reports\Categories\Query
* *
* @deprecated 9.3.0 Categories\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Categories\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
@ -32,22 +32,26 @@ class Query extends ReportsQuery {
/** /**
* Valid fields for Categories report. * Valid fields for Categories report.
* *
* @deprecated 9.3.0 Categories\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Categories\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get categories data based on the current query vars. * Get categories data based on the current query vars.
* *
* @deprecated 9.3.0 Categories\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Categories\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_categories_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_categories_query_args', $this->get_query_vars() );
$results = \WC_Data_Store::load( self::REPORT_NAME )->get_data( $args ); $results = \WC_Data_Store::load( self::REPORT_NAME )->get_data( $args );
return apply_filters( 'woocommerce_analytics_categories_select_query', $results, $args ); return apply_filters( 'woocommerce_analytics_categories_select_query', $results, $args );

View File

@ -31,7 +31,7 @@ class Controller extends GenericController implements ExportableInterface {
protected $rest_base = 'reports/coupons'; protected $rest_base = 'reports/coupons';
/** /**
* Get data from `'coupons'` Query. * Get data from `'coupons'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -22,29 +22,33 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Coupons\Query * API\Reports\Coupons\Query
* *
* @deprecated 9.3.0 Coupons\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Coupons\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for Products report. * Valid fields for Products report.
* *
* @deprecated 9.3.0 Coupons\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Coupons\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get product data based on the current query vars. * Get product data based on the current query vars.
* *
* @deprecated 9.3.0 Coupons\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Coupons\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_coupons_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_coupons_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-coupons' ); $data_store = \WC_Data_Store::load( 'report-coupons' );

View File

@ -54,7 +54,7 @@ class Controller extends GenericStatsController {
} }
/** /**
* Get data from `'coupons-stats'` Query. * Get data from `'coupons-stats'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -22,29 +22,33 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Coupons\Stats\Query * API\Reports\Coupons\Stats\Query
* *
* @deprecated 9.3.0 Coupons\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Coupons\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for Products report. * Valid fields for Products report.
* *
* @deprecated 9.3.0 Coupons\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Coupons\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get product data based on the current query vars. * Get product data based on the current query vars.
* *
* @deprecated 9.3.0 Coupons\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Coupons\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_coupons_stats_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_coupons_stats_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-coupons-stats' ); $data_store = \WC_Data_Store::load( 'report-coupons-stats' );

View File

@ -34,7 +34,7 @@ class Controller extends GenericController implements ExportableInterface {
protected $rest_base = 'reports/customers'; protected $rest_base = 'reports/customers';
/** /**
* Get data from Query. * Get data from Customers\Query.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -23,18 +23,20 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Customers\Stats\Query * API\Reports\Customers\Stats\Query
* *
* @deprecated 9.3.0 Customers\Stats\Query class is deprecated, please use Reports\Customers\Query with a custom name, GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Customers\Stats\Query class is deprecated, please use `Reports\Customers\Query` with a custom name, `GenericQuery`, `\WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for Customers report. * Valid fields for Customers report.
* *
* @deprecated 9.3.0 Customers\Stats\Query class is deprecated, please use Reports\Customers\Query with a custom name, GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Customers\Stats\Query class is deprecated, please use `Reports\Customers\Query` with a custom name, `GenericQuery`, `\WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`Reports\Customers\Query` with a custom name, `GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array( return array(
'per_page' => get_option( 'posts_per_page' ), // not sure if this should be the default. 'per_page' => get_option( 'posts_per_page' ), // not sure if this should be the default.
'page' => 1, 'page' => 1,
@ -47,11 +49,13 @@ class Query extends ReportsQuery {
/** /**
* Get product data based on the current query vars. * Get product data based on the current query vars.
* *
* @deprecated 9.3.0 Customers\Stats\Query class is deprecated, please use Reports\Customers\Query with a custom name, GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Customers\Stats\Query class is deprecated, please use `Reports\Customers\Query` with a custom name, `GenericQuery`, `\WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'x.x.x', '`Reports\Customers\Query` with a custom name, `GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_customers_stats_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_customers_stats_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-customers-stats' ); $data_store = \WC_Data_Store::load( 'report-customers-stats' );

View File

@ -32,7 +32,7 @@ class Controller extends GenericController implements ExportableInterface {
protected $rest_base = 'reports/downloads'; protected $rest_base = 'reports/downloads';
/** /**
* Get data from `'downloads'` Query. * Get data from `'downloads'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -22,29 +22,33 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Downloads\Query * API\Reports\Downloads\Query
* *
* @deprecated 9.3.0 Downloads\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Downloads\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for downloads report. * Valid fields for downloads report.
* *
* @deprecated 9.3.0 Downloads\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Downloads\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get downloads data based on the current query vars. * Get downloads data based on the current query vars.
* *
* @deprecated 9.3.0 Downloads\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Downloads\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_downloads_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_downloads_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-downloads' ); $data_store = \WC_Data_Store::load( 'report-downloads' );

View File

@ -60,7 +60,7 @@ class Controller extends GenericStatsController {
} }
/** /**
* Get data from `'downloads-stats'` Query. * Get data from `'downloads-stats'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -12,29 +12,33 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Downloads\Stats\Query * API\Reports\Downloads\Stats\Query
* *
* @deprecated 9.3.0 Downloads\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Downloads\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for Orders report. * Valid fields for Orders report.
* *
* @deprecated 9.3.0 Downloads\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Downloads\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get revenue data based on the current query vars. * Get revenue data based on the current query vars.
* *
* @deprecated 9.3.0 Downloads\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Downloads\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_downloads_stats_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_downloads_stats_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-downloads-stats' ); $data_store = \WC_Data_Store::load( 'report-downloads-stats' );

View File

@ -175,7 +175,7 @@ abstract class GenericController extends \WC_REST_Reports_Controller {
/** /**
* Get the report data. * Get the report data.
* *
* Prepares query params, fetches the report data from the Query object, * Prepares query params, fetches the report data from the data store,
* prepares it for the response, and packs it into the convention-conforming response object. * prepares it for the response, and packs it into the convention-conforming response object.
* *
* @throws \WP_Error When the queried data is invalid. * @throws \WP_Error When the queried data is invalid.
@ -237,7 +237,7 @@ abstract class GenericController extends \WC_REST_Reports_Controller {
} }
/** /**
* Maps query arguments from the REST request, to be fed to Query. * Maps query arguments from the REST request, to be used to query the datastore.
* *
* `WP_REST_Request` does not expose a method to return all params covering defaults, * `WP_REST_Request` does not expose a method to return all params covering defaults,
* as it does for `$request['param']` accessor. * as it does for `$request['param']` accessor.

View File

@ -207,7 +207,7 @@ abstract class GenericStatsController extends GenericController {
/** /**
* Get the report data. * Get the report data.
* *
* Prepares query params, fetches the report data from the Query object, * Prepares query params, fetches the report data from the data store,
* prepares it for the response, and packs it into the convention-conforming response object. * prepares it for the response, and packs it into the convention-conforming response object.
* *
* @override GenericController::get_items() * @override GenericController::get_items()

View File

@ -31,7 +31,7 @@ class Controller extends GenericController implements ExportableInterface {
protected $rest_base = 'reports/orders'; protected $rest_base = 'reports/orders';
/** /**
* Get data from Query. * Get data from Orders\Query.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -31,7 +31,7 @@ class Controller extends GenericStatsController {
protected $rest_base = 'reports/orders/stats'; protected $rest_base = 'reports/orders/stats';
/** /**
* Get data from Query. * Get data from Orders\Stats\Query.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -478,7 +478,7 @@ class Controller extends GenericController {
/** /**
* Prepare links for the request. * Prepare links for the request.
* *
* @param \Automattic\WooCommerce\Admin\API\Reports\Query $object Object data. * @param object $object data.
* @return array * @return array
*/ */
protected function prepare_links( $object ) { protected function prepare_links( $object ) {

View File

@ -42,7 +42,7 @@ class Controller extends GenericController implements ExportableInterface {
); );
/** /**
* Get data from `'products'` Query. * Get data from `'products'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -23,29 +23,33 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Products\Query * API\Reports\Products\Query
* *
* @deprecated 9.3.0 Products\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Products\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for Products report. * Valid fields for Products report.
* *
* @deprecated 9.3.0 Products\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Products\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get product data based on the current query vars. * Get product data based on the current query vars.
* *
* @deprecated 9.3.0 Products\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Products\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_products_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_products_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-products' ); $data_store = \WC_Data_Store::load( 'report-products' );

View File

@ -48,7 +48,7 @@ class Controller extends GenericStatsController {
} }
/** /**
* Get data from `'products-stats'` Query. * Get data from `'products-stats'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *
@ -61,7 +61,7 @@ class Controller extends GenericStatsController {
} }
/** /**
* Maps query arguments from the REST request, to be fed to Query. * Maps query arguments from the REST request to be used to query the datastore.
* *
* @param \WP_REST_Request $request Full request object. * @param \WP_REST_Request $request Full request object.
* @return array Simplified array of params. * @return array Simplified array of params.

View File

@ -23,29 +23,33 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Products\Stats\Query * API\Reports\Products\Stats\Query
* *
* @deprecated 9.3.0 Products\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Products\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for Products report. * Valid fields for Products report.
* *
* @deprecated 9.3.0 Products\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Products\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get product data based on the current query vars. * Get product data based on the current query vars.
* *
* @deprecated 9.3.0 Products\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Products\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_products_stats_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_products_stats_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-products-stats' ); $data_store = \WC_Data_Store::load( 'report-products-stats' );

View File

@ -10,17 +10,31 @@ defined( 'ABSPATH' ) || exit;
/** /**
* Admin\API\Reports\Query * Admin\API\Reports\Query
* *
* @deprecated 9.3.0 Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
abstract class Query extends \WC_Object_Query { abstract class Query extends \WC_Object_Query {
/**
* Create a new query.
*
* @deprecated 9.3.0 Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*
* @param array $args Criteria to query on in a format similar to WP_Query.
*/
public function __construct( $args = array() ) {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
parent::__construct( $args );
}
/** /**
* Get report data matching the current query vars. * Get report data matching the current query vars.
* *
* @deprecated 9.3.0 Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array|object of WC_Product objects * @return array|object of WC_Product objects
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
/* translators: %s: Method name */ /* translators: %s: Method name */
return new \WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) ); return new \WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
} }

View File

@ -36,7 +36,7 @@ class Controller extends GenericController implements ExportableInterface {
protected $rest_base = 'reports/taxes'; protected $rest_base = 'reports/taxes';
/** /**
* Get data from `'taxes'` Query. * Get data from `'taxes'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -22,29 +22,33 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Taxes\Query * API\Reports\Taxes\Query
* *
* @deprecated 9.3.0 Taxes\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Taxes\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for Taxes report. * Valid fields for Taxes report.
* *
* @deprecated 9.3.0 Taxes\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Taxes\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get product data based on the current query vars. * Get product data based on the current query vars.
* *
* @deprecated 9.3.0 Taxes\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Taxes\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_taxes_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_taxes_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-taxes' ); $data_store = \WC_Data_Store::load( 'report-taxes' );

View File

@ -84,7 +84,7 @@ class Controller extends GenericStatsController {
} }
/** /**
* Get data from `'taxes-stats'` Query. * Get data from `'taxes-stats'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -23,29 +23,33 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Taxes\Stats\Query * API\Reports\Taxes\Stats\Query
* *
* @deprecated 9.3.0 Taxes\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Taxes\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for Taxes report. * Valid fields for Taxes report.
* *
* @deprecated 9.3.0 Taxes\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Taxes\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get tax stats data based on the current query vars. * Get tax stats data based on the current query vars.
* *
* @deprecated 9.3.0 Taxes\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Taxes\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_taxes_stats_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_taxes_stats_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-taxes-stats' ); $data_store = \WC_Data_Store::load( 'report-taxes-stats' );

View File

@ -50,7 +50,7 @@ class Controller extends GenericController implements ExportableInterface {
); );
/** /**
* Get data from `'variations'` Query. * Get data from `'variations'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -23,29 +23,33 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Variations\Query * API\Reports\Variations\Query
* *
* @deprecated 9.3.0 Variations\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Variations\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for Products report. * Valid fields for Products report.
* *
* @deprecated 9.3.0 Variations\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Variations\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get product data based on the current query vars. * Get product data based on the current query vars.
* *
* @deprecated 9.3.0 Variations\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Variations\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_variations_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_variations_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-variations' ); $data_store = \WC_Data_Store::load( 'report-variations' );

View File

@ -46,7 +46,7 @@ class Controller extends GenericStatsController {
} }
/** /**
* Get data from `'variations-stats'` Query. * Get data from `'variations-stats'` GenericQuery.
* *
* @override GenericController::get_datastore_data() * @override GenericController::get_datastore_data()
* *

View File

@ -23,29 +23,33 @@ use Automattic\WooCommerce\Admin\API\Reports\Query as ReportsQuery;
/** /**
* API\Reports\Variations\Stats\Query * API\Reports\Variations\Stats\Query
* *
* @deprecated 9.3.0 Variations\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Variations\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
*/ */
class Query extends ReportsQuery { class Query extends ReportsQuery {
/** /**
* Valid fields for Products report. * Valid fields for Products report.
* *
* @deprecated 9.3.0 Variations\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Variations\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
protected function get_default_query_vars() { protected function get_default_query_vars() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
return array(); return array();
} }
/** /**
* Get variations data based on the current query vars. * Get variations data based on the current query vars.
* *
* @deprecated 9.3.0 Variations\Stats\Query class is deprecated, please use GenericQuery or \WC_Object_Query instead. * @deprecated 9.3.0 Variations\Stats\Query class is deprecated. Please use `GenericQuery`, \WC_Object_Query`, or use `DataStore` directly.
* *
* @return array * @return array
*/ */
public function get_data() { public function get_data() {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '9.3.0', '`GenericQuery`, `\WC_Object_Query`, or direct `DataStore` use' );
$args = apply_filters( 'woocommerce_analytics_variations_stats_query_args', $this->get_query_vars() ); $args = apply_filters( 'woocommerce_analytics_variations_stats_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-variations-stats' ); $data_store = \WC_Data_Store::load( 'report-variations-stats' );