You are here

class ProductVariation in Commerce Migrate 3.1.x

Same name in this branch
  1. 3.1.x modules/csv_example/src/Plugin/migrate/source/ProductVariation.php \Drupal\commerce_migrate_csv_example\Plugin\migrate\source\ProductVariation
  2. 3.1.x modules/ubercart/src/Plugin/migrate/source/uc7/ProductVariation.php \Drupal\commerce_migrate_ubercart\Plugin\migrate\source\uc7\ProductVariation
  3. 3.1.x modules/ubercart/src/Plugin/migrate/source/uc6/ProductVariation.php \Drupal\commerce_migrate_ubercart\Plugin\migrate\source\uc6\ProductVariation
Same name and namespace in other branches
  1. 8.2 modules/csv_example/src/Plugin/migrate/source/ProductVariation.php \Drupal\commerce_migrate_csv_example\Plugin\migrate\source\ProductVariation
  2. 3.0.x modules/csv_example/src/Plugin/migrate/source/ProductVariation.php \Drupal\commerce_migrate_csv_example\Plugin\migrate\source\ProductVariation

Gets the product variations rows.

Trims each cell in the each row of the source CSV.

Plugin annotation


@MigrateSource(
  id = "csv_example_product_variation"
)

Hierarchy

  • class \Drupal\commerce_migrate_csv_example\Plugin\migrate\source\ProductVariation extends \Drupal\migrate_source_csv\Plugin\migrate\source\CSV

Expanded class hierarchy of ProductVariation

File

modules/csv_example/src/Plugin/migrate/source/ProductVariation.php, line 17

Namespace

Drupal\commerce_migrate_csv_example\Plugin\migrate\source
View source
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);
  }

}

Members