2018-12-17 16:20:11 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* REST API Customers Controller
|
|
|
|
*
|
|
|
|
* Handles requests to /customers/*
|
|
|
|
*
|
|
|
|
* @package WooCommerce Admin/API
|
|
|
|
*/
|
|
|
|
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Customers controller.
|
|
|
|
*
|
|
|
|
* @package WooCommerce Admin/API
|
2019-02-12 19:06:22 +00:00
|
|
|
* @extends WC_Admin_REST_Reports_Customers_Controller
|
2018-12-17 16:20:11 +00:00
|
|
|
*/
|
2019-02-12 19:06:22 +00:00
|
|
|
class WC_Admin_REST_Customers_Controller extends WC_Admin_REST_Reports_Customers_Controller {
|
2018-12-17 16:20:11 +00:00
|
|
|
|
2019-01-18 02:52:58 +00:00
|
|
|
/**
|
2019-02-12 19:06:22 +00:00
|
|
|
* Route base.
|
2019-01-18 02:52:58 +00:00
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2019-02-12 19:06:22 +00:00
|
|
|
protected $rest_base = 'customers';
|
2019-02-19 19:35:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps query arguments from the REST request.
|
|
|
|
*
|
|
|
|
* @param array $request Request array.
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function prepare_reports_query( $request ) {
|
2019-03-13 17:14:02 +00:00
|
|
|
$args = parent::prepare_reports_query( $request );
|
2019-02-19 19:35:29 +00:00
|
|
|
$args['customers'] = $request['include'];
|
|
|
|
return $args;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the query params for collections.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function get_collection_params() {
|
2019-03-13 17:14:02 +00:00
|
|
|
$params = parent::get_collection_params();
|
2019-02-19 19:35:29 +00:00
|
|
|
$params['include'] = $params['customers'];
|
|
|
|
unset( $params['customers'] );
|
|
|
|
return $params;
|
|
|
|
}
|
2018-12-17 16:20:11 +00:00
|
|
|
}
|