You are here

public function PreRowSave::onPreRowSave 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::onPreRowSave()
  2. 3.1.x modules/ubercart/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_ubercart\EventSubscriber\PreRowSave::onPreRowSave()
Same name and namespace in other branches
  1. 8.2 modules/magento/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_magento\EventSubscriber\PreRowSave::onPreRowSave()
  2. 3.0.x modules/magento/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_magento\EventSubscriber\PreRowSave::onPreRowSave()

Reacts to the PRE_ROW_SAVE event.

Parameters

\Drupal\migrate\Event\MigratePreRowSaveEvent $event: The migrate pre-row-save event.

File

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

Class

PreRowSave
Handles order and order variation references.

Namespace

Drupal\commerce_migrate_magento\EventSubscriber

Code

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();
      }
    }
  }
}