- Issue created by @Anybody
- 🇩🇪Germany Anybody Porta Westfalica
This might be a very simple starting point, based on some tests I found:
/** @var \Drupal\commerce_reports\ReportTypeManager $reportTypeManager */ $reportTypeManager = \Drupal::service('plugin.manager.commerce_report_type'); /** @var \Drupal\commerce_reports\ReportQueryBuilder $reportQueryBuilder */ $reportQueryBuilder = \Drupal::service('commerce_reports.query_builder'); /** @var \Drupal\commerce_reports\Plugin\Commerce\ReportType\ReportTypeInterface $report_type_plugin */ $orderReportPlugin = $reportTypeManager->createInstance('order_report'); $query = $reportQueryBuilder->getQuery($orderReportPlugin); $query->accessCheck(TRUE) ->range(0, 50) ->sort('quantity', 'DESC'); $results = $query->execute();