You are here

class PreRowSave in Commerce Migrate 3.1.x

Same name in this branch
  1. 3.1.x modules/magento/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_magento\EventSubscriber\PreRowSave
  2. 3.1.x modules/ubercart/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_ubercart\EventSubscriber\PreRowSave
Same name and namespace in other branches
  1. 8.2 modules/magento/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_magento\EventSubscriber\PreRowSave
  2. 3.0.x modules/magento/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_magento\EventSubscriber\PreRowSave

Handles order and order variation references.

@package \Drupal\commerce_migrate\EventSubscriber

Hierarchy

  • class \Drupal\commerce_migrate_magento\EventSubscriber\PreRowSave implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of PreRowSave

1 string reference to 'PreRowSave'
commerce_migrate_magento.services.yml in modules/magento/commerce_migrate_magento.services.yml
modules/magento/commerce_migrate_magento.services.yml
1 service uses PreRowSave
commerce_migrate.ubercart.migrate_pre_row_save in modules/magento/commerce_migrate_magento.services.yml
Drupal\commerce_migrate_magento\EventSubscriber\PreRowSave

File

modules/magento/src/EventSubscriber/PreRowSave.php, line 15

Namespace

Drupal\commerce_migrate_magento\EventSubscriber
View source
class PreRowSave implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[MigrateEvents::PRE_ROW_SAVE][] = 'onPreRowSave';
    return $events;
  }

  /**
   * Reacts to the PRE_ROW_SAVE event.
   *
   * @param \Drupal\migrate\Event\MigratePreRowSaveEvent $event
   *   The migrate pre-row-save event.
   */
  public function onPreRowSave(MigratePreRowSaveEvent $event) {
    $migration = $event
      ->getMigration();
    $destination_configuration = $migration
      ->getDestinationConfiguration();
    if ($destination_configuration['plugin'] === 'entity:profile') {
      if ($profile_id = $event
        ->getRow()
        ->getDestinationProperty('profile_id')) {
        if ($profile = Profile::load($profile_id)) {
          $profile
            ->setNewRevision();
        }
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PreRowSave::getSubscribedEvents public static function
PreRowSave::onPreRowSave public function Reacts to the PRE_ROW_SAVE event.