CommerceCustomerProfileReference.php in Commerce Migrate 8.2
File
modules/commerce/src/Plugin/migrate/field/commerce1/CommerceCustomerProfileReference.php
View source
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\field\commerce1;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
class CommerceCustomerProfileReference extends FieldPluginBase {
public $fieldNameMap = [
'commerce_customer_billing' => 'billing_profile',
'commerce_customer_shipping' => 'shipping_profile',
];
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
$this
->defineValueProcessPipeline($migration, $field_name, $data);
}
public function defineValueProcessPipeline(MigrationInterface $migration, $field_name, $data) {
$destination_field_name = isset($this->fieldNameMap[$field_name]) ? $this->fieldNameMap[$field_name] : $field_name;
$process = [
'plugin' => 'commerce_migrate_commerce_reference_revision',
'migration' => 'commerce1_profile',
'source' => $field_name,
'no_stub' => TRUE,
];
$migration
->setProcessOfProperty($destination_field_name, $process);
}
}