Loading modules/order/src/EventSubscriber/OrderSetAmwsStore.php +11 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Drupal\commerce_amws_order\EventSubscriber; use Drupal\commerce_amws\MachineName\Field\Order as OrderField; use Drupal\entity_sync\Import\Event\Events; use Drupal\entity_sync\Import\ManagerInterface; use Drupal\entity_sync\Event\TerminateOperationEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; Loading Loading @@ -36,7 +37,16 @@ class OrderSetAmwsStore implements EventSubscriberInterface { return; } $event->getData()['local_entity']->set( $data = $event->getData(); // We only need to set the store the first time that the order is // created. No need to reset it on updates, and nothing to do on skips. If // the action was a skip, the `local_entity` wouldn't be available in the // data and we would be getting an error anyways. if ($data['action'] !== ManagerInterface::ACTION_CREATE) { return; } $data['local_entity']->set( OrderField::AMWS_STORE, ['target_id' => $event->getContext()['amws_store_id']] ); Loading Loading
modules/order/src/EventSubscriber/OrderSetAmwsStore.php +11 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Drupal\commerce_amws_order\EventSubscriber; use Drupal\commerce_amws\MachineName\Field\Order as OrderField; use Drupal\entity_sync\Import\Event\Events; use Drupal\entity_sync\Import\ManagerInterface; use Drupal\entity_sync\Event\TerminateOperationEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; Loading Loading @@ -36,7 +37,16 @@ class OrderSetAmwsStore implements EventSubscriberInterface { return; } $event->getData()['local_entity']->set( $data = $event->getData(); // We only need to set the store the first time that the order is // created. No need to reset it on updates, and nothing to do on skips. If // the action was a skip, the `local_entity` wouldn't be available in the // data and we would be getting an error anyways. if ($data['action'] !== ManagerInterface::ACTION_CREATE) { return; } $data['local_entity']->set( OrderField::AMWS_STORE, ['target_id' => $event->getContext()['amws_store_id']] ); Loading