You are here

public function Store::prepareRow in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 modules/ubercart/src/Plugin/migrate/source/Store.php \Drupal\commerce_migrate_ubercart\Plugin\migrate\source\Store::prepareRow()
  2. 3.0.x modules/ubercart/src/Plugin/migrate/source/Store.php \Drupal\commerce_migrate_ubercart\Plugin\migrate\source\Store::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/Store.php, line 32

Class

Store
Gets the Ubercart store data.

Namespace

Drupal\commerce_migrate_ubercart\Plugin\migrate\source

Code

public function prepareRow(Row $row) {
  $store_owner = $row
    ->getSourceProperty('uc_store_owner');
  $query = $this
    ->select('users', 'u')
    ->fields('u', [
    'uid',
  ])
    ->condition('name', $store_owner);
  $uid = $query
    ->execute()
    ->fetchField();
  $row
    ->setSourceProperty('uid', $uid);
  $country = $row
    ->getSourceProperty('uc_store_country');

  // Get the country iso code 2 for this country.
  $query = $this
    ->select('uc_countries', 'ucc')
    ->fields('ucc', [
    'country_iso_code_2',
  ])
    ->condition('country_id', $country);
  $country_iso_code_2 = $query
    ->execute()
    ->fetchField();
  $row
    ->setSourceProperty('country_iso_code_2', $country_iso_code_2);
  return parent::prepareRow($row);
}