ProductVariation.php in Commerce Migrate 8.2
Same filename in this branch
Same filename and directory in other branches
File
modules/csv_example/src/Plugin/migrate/source/ProductVariation.phpView source
<?php
namespace Drupal\commerce_migrate_csv_example\Plugin\migrate\source;
use Drupal\migrate\Row;
use Drupal\migrate_source_csv\Plugin\migrate\source\CSV;
/**
* Gets the product variations rows.
*
* Trims each cell in the each row of the source CSV.
*
* @MigrateSource(
* id = "csv_example_product_variation"
* )
*/
class ProductVariation extends CSV {
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
// Trim all the source values.
foreach ($row
->getSource() as $key => $value) {
if (is_string($value)) {
$row
->setSourceProperty($key, trim($value));
}
}
return parent::prepareRow($row);
}
}
Classes
Name | Description |
---|---|
ProductVariation | Gets the product variations rows. |