You are here

protected function PrepareRow::setCommerceProductProperty in Commerce Migrate 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/ubercart/src/EventSubscriber/PrepareRow.php \Drupal\commerce_migrate_ubercart\EventSubscriber\PrepareRow::setCommerceProductProperty()
  2. 3.1.x modules/ubercart/src/EventSubscriber/PrepareRow.php \Drupal\commerce_migrate_ubercart\EventSubscriber\PrepareRow::setCommerceProductProperty()

Helper to set a commerce_product property in the source row.

Parameters

\Drupal\migrate\Row $row: The row object.

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration.

string $type_name: The type name.

1 call to PrepareRow::setCommerceProductProperty()
PrepareRow::onPrepareRow in modules/ubercart/src/EventSubscriber/PrepareRow.php
Responds to prepare row event.

File

modules/ubercart/src/EventSubscriber/PrepareRow.php, line 217

Class

PrepareRow
Handles migrate_plus prepare row event.

Namespace

Drupal\commerce_migrate_ubercart\EventSubscriber

Code

protected function setCommerceProductProperty(Row $row, MigrationInterface $migration, $type_name) {
  if ($this->productTypes == []) {
    $this->productTypes = $this
      ->getProductTypes($migration);
  }
  if (in_array($type_name, $this->productTypes)) {
    $row
      ->setSourceProperty('commerce_product', 1);
    return TRUE;
  }
  return FALSE;
}