CommerceLineItemReference.php in Commerce Migrate 3.0.x
File
modules/commerce/src/Plugin/migrate/field/commerce1/CommerceLineItemReference.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 CommerceLineItemReference extends FieldPluginBase {
public $fieldNameMap = [
'commerce_line_items' => 'order_items',
];
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' => 'migration_lookup',
'migration' => 'commerce1_order_item',
'source' => $field_name,
'no_stub' => TRUE,
],
[
'plugin' => 'skip_on_empty',
'method' => 'process',
],
];
$migration
->setProcessOfProperty($destination_field_name, $process);
}
}