You are here

public function Profile::prepareRow in Commerce Migrate 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/commerce/src/Plugin/migrate/source/commerce1/Profile.php \Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1\Profile::prepareRow()
  2. 3.1.x modules/commerce/src/Plugin/migrate/source/commerce1/Profile.php \Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1\Profile::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/commerce/src/Plugin/migrate/source/commerce1/Profile.php, line 76

Class

Profile
Drupal 7 commerce_customer_profile source from database.

Namespace

Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1

Code

public function prepareRow(Row $row) {
  $row
    ->setSourceProperty('data', unserialize($row
    ->getSourceProperty('data')));
  $row
    ->setSourceProperty('revision_data', unserialize($row
    ->getSourceProperty('revision_data')));
  $profile_id = $row
    ->getSourceProperty('profile_id');
  $revision_id = $row
    ->getSourceProperty('revision_id');

  // Get Field API field values.
  foreach (array_keys($this
    ->getFields('commerce_customer_profile', $row
    ->getSourceProperty('type'))) as $field) {
    $row
      ->setSourceProperty($field, $this
      ->getFieldValues('commerce_customer_profile', $field, $profile_id, $revision_id));
  }
  return parent::prepareRow($row);
}