class PreRowSave in Commerce Migrate 3.1.x
Same name in this branch
- 3.1.x modules/magento/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_magento\EventSubscriber\PreRowSave
- 3.1.x modules/ubercart/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_ubercart\EventSubscriber\PreRowSave
Same name and namespace in other branches
- 8.2 modules/ubercart/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_ubercart\EventSubscriber\PreRowSave
- 3.0.x modules/ubercart/src/EventSubscriber/PreRowSave.php \Drupal\commerce_migrate_ubercart\EventSubscriber\PreRowSave
Handles order and order variation references.
@package \Drupal\commerce_migrate\EventSubscriber
Hierarchy
- class \Drupal\commerce_migrate_ubercart\EventSubscriber\PreRowSave implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of PreRowSave
1 string reference to 'PreRowSave'
- commerce_migrate_ubercart.services.yml in modules/
ubercart/ commerce_migrate_ubercart.services.yml - modules/ubercart/commerce_migrate_ubercart.services.yml
1 service uses PreRowSave
File
- modules/
ubercart/ src/ EventSubscriber/ PreRowSave.php, line 16
Namespace
Drupal\commerce_migrate_ubercart\EventSubscriberView 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.
*
* If the profile exists, then set it as a new revision.
*
* @param \Drupal\migrate\Event\MigratePreRowSaveEvent $event
* The event object.
*/
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();
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PreRowSave:: |
public static | function | ||
PreRowSave:: |
public | function | Reacts to the PRE_ROW_SAVE event. |