You are here

public function PreRowSave::onPreRowSave in Commerce Migrate 8.2

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

Reacts to the PRE_ROW_SAVE event.

If the profile exists, then set it as a new revision.

Parameters

\Drupal\migrate\Event\MigratePreRowSaveEvent $event: The event object.

File

modules/ubercart/src/EventSubscriber/PreRowSave.php, line 34

Class

PreRowSave
Handles order and order variation references.

Namespace

Drupal\commerce_migrate_ubercart\EventSubscriber

Code

public function onPreRowSave(MigratePreRowSaveEvent $event) {
  $migration = $event
    ->getMigration();
  $source_plugin = $migration
    ->getSourcePlugin();
  if (is_a($source_plugin, ProfileBilling::class)) {
    if ($profile_id = $event
      ->getRow()
      ->getDestinationProperty('profile_id')) {
      if ($profile = ProfileEntity::load($profile_id)) {
        $profile
          ->setNewRevision();
      }
    }
  }
}