Automattic\WooCommerce\Admin\API\Reports

DataStore::add_intervals_sql_params()protectedWC 1.0

Fills FROM and WHERE clauses of SQL request for 'Intervals' section of data response based on user supplied parameters.

Метод класса: DataStore{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->add_intervals_sql_params( $query_args, $table_name );
$query_args(массив) (обязательный)
Parameters supplied by the user.
$table_name(строка) (обязательный)
Name of the db table relevant for the date constraint.

Код DataStore::add_intervals_sql_params() WC 8.7.0

protected function add_intervals_sql_params( $query_args, $table_name ) {
	$this->clear_sql_clause( array( 'from', 'where_time', 'where' ) );

	$this->add_time_period_sql_params( $query_args, $table_name );

	if ( isset( $query_args['interval'] ) && '' !== $query_args['interval'] ) {
		$interval = $query_args['interval'];
		$this->clear_sql_clause( 'select' );
		$this->add_sql_clause( 'select', TimeInterval::db_datetime_format( $interval, $table_name, $this->date_column_name ) );
	}
}