You are here

public function OrderPlacedEventSubscriber::generateReports in Commerce Reporting 8

Generates order reports once output flushed.

This creates the base order report populated with the bundle plugin ID, order ID, and created timestamp from when the order was placed. Each plugin then sets its values.

Parameters

\Symfony\Component\HttpKernel\Event\PostResponseEvent $event: The post response event.

Throws

\Drupal\Core\Entity\EntityStorageException

File

src/EventSubscriber/OrderPlacedEventSubscriber.php, line 73

Class

OrderPlacedEventSubscriber
Event subscriber to order placed transition event.

Namespace

Drupal\commerce_reports\EventSubscriber

Code

public function generateReports(PostResponseEvent $event) {
  $order_ids = $this->state
    ->get('commerce_order_reports', []);
  $this->orderReportGenerator
    ->generateReports($order_ids);

  // @todo this could lose data, possibly as its global state.
  $this->state
    ->set('commerce_order_reports', []);
}