You are here

public static function OrderEventSubscriber::getSubscribedEvents in Commerce Stock 8

File

src/EventSubscriber/OrderEventSubscriber.php, line 309

Class

OrderEventSubscriber
Performs stock transactions on order and order item events.

Namespace

Drupal\commerce_stock\EventSubscriber

Code

public static function getSubscribedEvents() {
  $events = [
    // State change events fired on workflow transitions from state_machine.
    'commerce_order.place.post_transition' => [
      'onOrderPlace',
      -100,
    ],
    'commerce_order.cancel.post_transition' => [
      'onOrderCancel',
      -100,
    ],
    // Order storage events dispatched during entity operations in
    // CommerceContentEntityStorage.
    // ORDER_UPDATE handles new order items since ORDER_ITEM_INSERT doesn't.
    OrderEvents::ORDER_UPDATE => [
      'onOrderUpdate',
      -100,
    ],
    OrderEvents::ORDER_PREDELETE => [
      'onOrderDelete',
      -100,
    ],
    OrderEvents::ORDER_ITEM_UPDATE => [
      'onOrderItemUpdate',
      -100,
    ],
    OrderEvents::ORDER_ITEM_DELETE => [
      'onOrderItemDelete',
      -100,
    ],
  ];
  return $events;
}