ShippingFlatRate.php in Commerce Migrate 3.0.x
File
modules/ubercart/src/Plugin/migrate/source/ShippingFlatRate.php
View source
<?php
namespace Drupal\commerce_migrate_ubercart\Plugin\migrate\source;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
class ShippingFlatRate extends DrupalSqlBase {
public function query() {
return $this
->select('uc_flatrate_methods', 'f')
->fields('f');
}
public function fields() {
return [
'mid' => $this
->t('Method id'),
'title' => $this
->t('Flat rate title'),
'label' => $this
->t('Flat rate label'),
'base_rate' => $this
->t('Base rate'),
'product_rate' => $this
->t('Product rate'),
'currency_code' => $this
->t('Currency code'),
];
}
public function prepareRow(Row $row) {
$currency_code = $this
->variableGet('currency_code', 'USD');
$row
->setSourceProperty('currency_code', $currency_code);
return parent::prepareRow($row);
}
public function getIds() {
return [
'mid' => [
'type' => 'integer',
],
];
}
}