You are here

public function Order::getProcess in Commerce Migrate 8.2

Same name and namespace in other branches
  1. 3.1.x modules/commerce/src/Plugin/migrate/Order.php \Drupal\commerce_migrate_commerce\Plugin\migrate\Order::getProcess()
  2. 3.0.x modules/commerce/src/Plugin/migrate/Order.php \Drupal\commerce_migrate_commerce\Plugin\migrate\Order::getProcess()

Get the normalized process pipeline configuration describing the process plugins.

The process configuration is always normalized. All shorthand processing will be expanded into their full representations.

Return value

array The normalized configuration describing the process plugins.

Overrides FieldMigration::getProcess

See also

https://www.drupal.org/node/2129651#get-shorthand

File

modules/commerce/src/Plugin/migrate/Order.php, line 16

Class

Order
Plugin class for Commerce 1 order migrations to handle fields and profiles.

Namespace

Drupal\commerce_migrate_commerce\Plugin\migrate

Code

public function getProcess() {
  if (!$this->init) {
    $this->init = TRUE;
    $this->fieldDiscovery
      ->addEntityFieldProcesses($this, 'commerce_order');
    $definition = [
      'source' => [
        'plugin' => 'profile_field',
        'entity_type' => 'commerce_order',
        'ignore_map' => TRUE,
      ],
      'idMap' => [
        'plugin' => 'null',
      ],
      'destination' => [
        'plugin' => 'null',
      ],
    ];
    try {
      $field_migration = $this->migrationPluginManager
        ->createStubMigration($definition);
      $field_migration
        ->checkRequirements();
      foreach ($field_migration
        ->getSourcePlugin() as $row) {
        $field_name = $row
          ->getSourceProperty('field_name');
        $field_type = $row
          ->getSourceProperty('type');
        $this->process[$field_name] = $field_type;
      }
    } catch (RequirementsException $e) {

      // The checkRequirements() call will fail when the profile module does
      // not exist on the source site.
    }
  }
  return parent::getProcess();
}