public function Currency::prepareRow in Commerce Migrate 3.1.x
Same name in this branch
- 3.1.x modules/ubercart/src/Plugin/migrate/source/Currency.php \Drupal\commerce_migrate_ubercart\Plugin\migrate\source\Currency::prepareRow()
- 3.1.x modules/commerce/src/Plugin/migrate/source/commerce1/Currency.php \Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1\Currency::prepareRow()
Same name and namespace in other branches
- 8.2 modules/ubercart/src/Plugin/migrate/source/Currency.php \Drupal\commerce_migrate_ubercart\Plugin\migrate\source\Currency::prepareRow()
- 3.0.x modules/ubercart/src/Plugin/migrate/source/Currency.php \Drupal\commerce_migrate_ubercart\Plugin\migrate\source\Currency::prepareRow()
Adds additional data to the row.
Parameters
\Drupal\migrate\Row $row: The row object.
Return value
bool FALSE if this row needs to be skipped.
Overrides SourcePluginBase::prepareRow
File
- modules/
ubercart/ src/ Plugin/ migrate/ source/ Currency.php, line 76
Class
- Currency
- Gets the Ubercart currency data.
Namespace
Drupal\commerce_migrate_ubercart\Plugin\migrate\sourceCode
public function prepareRow(Row $row) {
// Get the currency name and the country numeric code by using the
// destination's currency importer. These values are not available from
// the ubercart source.
// @todo find a better to get the currency name and the country numeric code
// without peaking into the destination.
$currency_code = $row
->getSourceProperty('uc_currency_code');
$currencyImporter = new CurrencyImporter($this->entityTypeManager, $this->languageManager);
$currency = $currencyImporter
->import($currency_code);
$name = $currency
->getName();
$numeric_code = $currency
->getNumericCode();
$row
->setSourceProperty('currency_name', $name);
$row
->setSourceProperty('numeric_code', $numeric_code);
return parent::prepareRow($row);
}