public function OrderPlacedEventSubscriber::flagOrder in Commerce Reporting 8
Flags the order to have a report generated.
@todo come up with better flagging.
Parameters
\Drupal\state_machine\Event\WorkflowTransitionEvent $event: The workflow transition event.
File
- src/
EventSubscriber/ OrderPlacedEventSubscriber.php, line 54
Class
- OrderPlacedEventSubscriber
- Event subscriber to order placed transition event.
Namespace
Drupal\commerce_reports\EventSubscriberCode
public function flagOrder(WorkflowTransitionEvent $event) {
$order = $event
->getEntity();
$existing = $this->state
->get('commerce_order_reports', []);
$existing[] = $order
->id();
$this->state
->set('commerce_order_reports', $existing);
}