You are here

private function Product::getFileData in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 modules/magento/src/Plugin/migrate/source/m2/Product.php \Drupal\commerce_migrate_magento\Plugin\migrate\source\m2\Product::getFileData()
  2. 3.0.x modules/magento/src/Plugin/migrate/source/m2/Product.php \Drupal\commerce_migrate_magento\Plugin\migrate\source\m2\Product::getFileData()

Prepares an array of product SKU information.

Parameters

\Generator $file: The file object for the CSV file being processed.

Return value

array An array of product SKUs with two keys, 'configurable' and 'all'. Configurable is an array of all the SKUs for product of type 'configurable' * and 'all' is a list of all SKUs.

1 call to Product::getFileData()
Product::initializeIterator in modules/magento/src/Plugin/migrate/source/m2/Product.php

File

modules/magento/src/Plugin/migrate/source/m2/Product.php, line 134

Class

Product
Gets the product rows.

Namespace

Drupal\commerce_migrate_magento\Plugin\migrate\source\m2

Code

private function getFileData(\Generator $file) {
  $file_data = [];
  if (!$this->fileData) {
    $file_data = [];
    foreach ($file as $row) {
      if ($row['product_type'] === 'configurable') {
        $file_data['configurable'][] = $row['sku'];
      }
      $file_data['all_sku'][] = $row['sku'];
    }
  }
  return $file_data;
}