Commit 5c7e1729 authored by quietone's avatar quietone Committed by heddn

Issue #2969074 by quietone, heddn: Renaming for Commerce sub module

parent ee79501c
......@@ -45,10 +45,10 @@ function commerce_migrate_commerce_migration_plugins_alter(array &$migrations) {
if ((is_a($migration['class'], FieldMigration::class, TRUE))) {
// Field storage.
if (is_a($source, Field::class)) {
$migration['source']['plugin'] = 'd7_commerce_field';
$migration['source']['plugin'] = 'commerce1_field';
$migration['process']['entity_type'] = _commerce_migrate_commerce_get_entity_type('commerce1_entity_type');
$migration['migration_dependencies']['required'][] = 'd7_commerce_product_type';
$migration['migration_dependencies']['required'][] = 'd7_commerce_product_variation_type';
$migration['migration_dependencies']['required'][] = 'commerce1_commerce_product_type';
$migration['migration_dependencies']['required'][] = 'commerce1_commerce_product_variation_type';
$migration['source']['constants']['prefix'] = 'attribute_';
$attributes_process = [];
$attributes_process['field_name_attribute'] =
......@@ -81,11 +81,11 @@ function commerce_migrate_commerce_migration_plugins_alter(array &$migrations) {
// must be after the process for the settings field.
$attributes_process['settings/handler_settings'] =
[
'plugin' => 'd7_attribute_handler_setting',
'plugin' => 'commerce1_attribute_handler_setting',
];
$migration['process'] += $attributes_process;
$migration['migration_dependencies']['required'][] = 'd7_commerce_product_type';
$migration['migration_dependencies']['required'][] = 'd7_commerce_product_variation_type';
$migration['migration_dependencies']['required'][] = 'commerce1_product_type';
$migration['migration_dependencies']['required'][] = 'commerce1_product_variation_type';
}
// Field instance widget settings.
......@@ -148,10 +148,10 @@ function commerce_migrate_commerce_migration_plugins_alter(array &$migrations) {
// View mode.
if (is_a($source, ViewMode::class)) {
$migration['source']['plugin'] = 'd7_commerce_view_mode';
$migration['source']['plugin'] = 'commerce1_view_mode';
// Add map for the destination entity type.
// Use the source entity type here because the source plugin,
// 'd7_commerce_view_mode', will add rows for the product displays.
// 'commerce1_view_mode', will add rows for the product displays.
$migration['process']['targetEntityType'] = _commerce_migrate_commerce_get_entity_type('entity_type');
$migration['process']['targetEntityType'][0]['map']['commerce_customer_profile'] = 'skip';
}
......@@ -229,7 +229,7 @@ function _commerce_migrate_commerce_get_product_node_types(array $migrations) {
// Get the product types.
/** @var \Drupal\migrate\Plugin\migrate\source\SqlBase $source_plugin */
$source_plugin = \Drupal::service('plugin.manager.migration')
->createStubMigration($migrations['d7_commerce_store'])
->createStubMigration($migrations['commerce1_store'])
->getSourcePlugin();
$product_node_types = [];
$connection = NULL;
......
id: d7_commerce_billing_profile
id: commerce1_billing_profile
label: Commerce customer profile
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: d7_billing_profile
plugin: commerce1_billing_profile
process:
profile_id: profile_id
revision_id: revision_id
......
id: d7_commerce_currency
id: commerce1_currency
label: Commerce currency
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: commerce_currency
variables:
......
id: d7_commerce_default_store
id: commerce1_default_store
label: Commerce default store
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: variable
variables:
......@@ -15,11 +15,11 @@ process:
name: site_name
id:
plugin: migration_lookup
migration: d7_commerce_store
migration: commerce1_store
source: 'constants/site_name'
destination:
plugin: default_commerce_store
config_name: commerce_store.settings
migration_dependencies:
required:
- d7_commerce_store
- commerce1_store
id: d7_commerce_message
id: commerce1_message
label: Commerce messages
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: d7_message
plugin: commerce1_message
process:
skip:
-
......@@ -52,7 +52,7 @@ process:
source: uid
source_entity_id:
plugin: migration_lookup
migration: d7_commerce_order
migration: commerce1_order
source: target_id
source_entity_type:
plugin: static_map
......@@ -73,6 +73,6 @@ destination:
destination_module: commerce_log
migration_dependencies:
required:
- d7_commerce_billing_profile
- d7_commerce_product_variation
- d7_commerce_order
- commerce1_billing_profile
- commerce1_product_variation
- commerce1_order
id: d7_commerce_order
id: commerce1_order
label: Commerce order
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
class: Drupal\commerce_migrate_commerce\Plugin\migrate\Order
source:
plugin: d7_order
plugin: commerce1_order
constants:
refresh_state: refresh_skip
process:
......@@ -46,7 +46,7 @@ destination:
destination_module: commerce_order
migration_dependencies:
required:
- d7_commerce_order_item
- d7_commerce_billing_profile
- commerce1_order_item
- commerce1_billing_profile
# - d7_field
# - d7_field_instance
id: d7_commerce_order_item
id: commerce1_order_item
label: Commerce order item
deriver: Drupal\commerce_migrate_commerce\Plugin\migrate\OrderItemDeriver
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: d7_line_item
plugin: commerce1_line_item
process:
order_item_id: line_item_id
revision_id: revision_id
......@@ -17,15 +17,15 @@ process:
title: title
purchased_entity:
plugin: migration_lookup
migration: d7_commerce_product_variation
migration: commerce1_product_variation
source: commerce_product
destination:
plugin: 'entity:commerce_order_item'
destination_module: commerce_order
migration_dependencies:
required:
- d7_commerce_default_store
- d7_commerce_product_variation
- d7_commerce_order_item_type
- commerce1_default_store
- commerce1_product_variation
- commerce1_order_item_type
# - d7_field
# - d7_field_instance
id: d7_commerce_order_item_type
id: commerce1_order_item_type
label: Commerce order item type
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: d7_order_item_type
plugin: commerce1_order_item_type
process:
id: type
type: type
......
id: d7_commerce_payment
id: commerce1_payment
label: Commerce payment
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: d7_payment_transaction
plugin: commerce1_payment_transaction
constants:
type: payment_manual
process:
......@@ -12,7 +12,7 @@ process:
payment_gateway:
-
plugin: migration_lookup
migration: d7_commerce_payment_gateway
migration: commerce1_payment_gateway
source: payment_method
-
plugin: skip_on_empty
......@@ -23,7 +23,7 @@ process:
order_id:
-
plugin: migration_lookup
migration: d7_commerce_order
migration: commerce1_order
source: order_id
-
plugin: skip_on_empty
......@@ -39,5 +39,5 @@ destination:
destination_module: commerce_payment
migration_dependencies:
required:
- d7_commerce_order
- d7_commerce_payment_gateway
- commerce1_order
- commerce1_payment_gateway
id: d7_commerce_payment_gateway
id: commerce1_payment_gateway
label: Commerce payment gateway
migration_tags:
- Drupal 7
- Commerce
source:
plugin: d7_commerce_payment_gateway
plugin: commerce1_payment_gateway
constants:
plugin: manual
process:
......
id: d7_commerce_product
id: commerce1_product
label: Commerce product
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
deriver: Drupal\commerce_migrate_commerce\Plugin\migrate\ProductDeriver
source:
plugin: d7_product_display
plugin: commerce1_product_display
process:
product_id: nid
title: title
......@@ -18,13 +18,13 @@ process:
path: path
variations:
plugin: migration_lookup
migration: d7_commerce_product_variation
migration: commerce1_product_variation
source: variations_field
destination:
plugin: 'entity:commerce_product'
destination_module: commerce_product
migration_dependencies:
required:
- d7_commerce_default_store
- d7_commerce_product_variation
- d7_commerce_product_type
- commerce1_default_store
- commerce1_product_variation
- commerce1_product_type
id: d7_commerce_product_type
id: commerce1_product_type
label: Commerce product type
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: d7_product_display_type
plugin: commerce1_product_display_type
variations:
matching: true
default: default
......
id: d7_commerce_product_variation
id: commerce1_product_variation
label: Commerce product variation
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
deriver: Drupal\commerce_migrate_commerce\Plugin\migrate\ProductVariationDeriver
source:
plugin: d7_product
plugin: commerce1_product
process:
variation_id: product_id
# The product_id field is NULL after this migration.
......@@ -32,6 +32,6 @@ destination:
destination_module: commerce_product
migration_dependencies:
required:
- d7_commerce_product_variation_type
- commerce1_product_variation_type
# - d7_field
# - d7_field_instance
id: d7_commerce_product_variation_type
id: commerce1_product_variation_type
label: Commerce product variation type
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: d7_product_type
plugin: commerce1_product_type
constants:
generate_title: false
line_item_type: product_variation
......
id: d7_commerce_shipping_flat_rate
id: commerce1_shipping_flat_rate
label: Commerce 1 shipping flat rate
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: d7_shipping_flat_rate
process:
......
id: d7_commerce_store
id: commerce1_store
label: Commerce store
migration_tags:
- Drupal 7
- Commerce 1
- Commerce
source:
plugin: variable
variables:
......@@ -31,4 +31,4 @@ destination:
migration_dependencies:
required:
- d7_user
- d7_commerce_currency
- commerce1_currency
......@@ -5,7 +5,7 @@ namespace Drupal\commerce_migrate_commerce\Plugin\migrate;
use Drupal\migrate_drupal\Plugin\migrate\FieldMigration;
/**
* Plugin class for Drupal 7 order migrations dealing with fields and profiles.
* Plugin class for Commerce 1 order migrations to handle fields and profiles.
*/
class Order extends FieldMigration {
......
......@@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Deriver for Drupal 7 line items based on line item types.
* Deriver for Commerce 1 line items based on line item types.
*/
class OrderItemDeriver extends DeriverBase implements ContainerDeriverInterface {
......@@ -71,7 +71,7 @@ class OrderItemDeriver extends DeriverBase implements ContainerDeriverInterface
*/
public function getDerivativeDefinitions($base_plugin_definition) {
// @todo: Convert to new trait. See https://www.drupal.org/node/2951550.
$order_item_types = static::getSourcePlugin('d7_order_item_type');
$order_item_types = static::getSourcePlugin('commerce1_order_item_type');
try {
$order_item_types->checkRequirements();
}
......
......@@ -85,7 +85,7 @@ class ProductDeriver extends DeriverBase implements ContainerDeriverInterface {
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$product_types = static::getSourcePlugin('d7_product_display_type');
$product_types = static::getSourcePlugin('commerce1_product_display_type');
try {
$product_types->checkRequirements();
}
......
......@@ -85,7 +85,7 @@ class ProductVariationDeriver extends DeriverBase implements ContainerDeriverInt
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$product_variation_types = static::getSourcePlugin('d7_product_type');
$product_variation_types = static::getSourcePlugin('commerce1_product_type');
try {
$product_variation_types->checkRequirements();
}
......
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\field\d7;
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\field\commerce1;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
......@@ -38,7 +38,7 @@ class CommerceCustomerProfileReference extends FieldPluginBase {
$destination_field_name = isset($this->fieldNameMap[$field_name]) ? $this->fieldNameMap[$field_name] : $field_name;
$process = [
'plugin' => 'commerce_migrate_commerce_reference_revision',
'migration' => 'd7_commerce_billing_profile',
'migration' => 'commerce1_billing_profile',
'source' => $field_name,
'no_stub' => TRUE,
];
......
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\field\d7;
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\field\commerce1;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
......@@ -37,7 +37,7 @@ class CommerceLineItemReference extends FieldPluginBase {
$destination_field_name = isset($this->fieldNameMap[$field_name]) ? $this->fieldNameMap[$field_name] : $field_name;
$process = [
'plugin' => 'migration_lookup',
'migration' => 'd7_commerce_order_item',
'migration' => 'commerce1_order_item',
'source' => $field_name,
];
$migration->setProcessOfProperty($destination_field_name, $process);
......
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\field\d7;
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\field\commerce1;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
......
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\field\d7;
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\field\commerce1;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
......
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\process\d7;
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\process\commerce1;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\MigrateSkipProcessException;
......@@ -11,7 +11,7 @@ use Drupal\migrate\Row;
* Adjusts the fields settings for attributes.
*
* @MigrateProcessPlugin(
* id = "d7_attribute_handler_setting"
* id = "commerce1_attribute_handler_setting"
* )
*/
class CommerceAttributeHandlerSetting extends ProcessPluginBase {
......
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\process\d7;
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\process\commerce1;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
......
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\process\d7;
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\process\commerce1;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
......
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\process\d7;
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\process\commerce1;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
/**
* Migrate commerce price from D7 to D8.
* Migrate commerce price from Commerce 1 to Commerce 2.
*
* @MigrateProcessPlugin(
* id = "commerce_migrate_commerce_price"
......
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\source\d7;
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;